In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you what it means to face the prototype chain of objects and prototypes in front-end development. The content is simple and clear, and I hope it can help you solve your doubts. Let the editor lead you to study and learn what it means to face the prototype chain of objects and prototypes in front-end development.
I. object-oriented:
Object-oriented is a method of program development, which takes the object as the basic unit of the program and encapsulates the program and data in order to improve the flexibility, reusability and expansibility of the software. The object is to put the data and the methods of manipulating the data together as an interdependent whole. When it comes to classes and objects, a class describes a group of objects with the same properties and behavior, and the abstraction of objects with the same properties and methods is the class. That is, the abstraction of the object is the class, and the instance of the class is the object. In object-oriented programming, the process of creating objects with classes is called instantiation.
The difference between process-oriented and object-oriented is that process-oriented is a direct programming method, which considers problems according to the thinking of programming language. A function is achieved by executing a set of statements sequentially, and the execution process of these statements is the whole program. Object-oriented is a more abstract programming method. Its goal is to make the module more abstract and reusable. Object-oriented features: encapsulation, inheritance, and polymorphism.
Process-oriented can be said to think in terms of details. Object-oriented can be said to think from a macro point of view.
Object creation methods include object literals, factories, prototypes, constructors, and mixed modes.
Prototype chain:
Each function we create has a prototype property, which is a pointer to an object whose purpose is to contain properties and methods that can be shared by all instances of a particular type. Then prototype is the prototype object of the object instance created by calling the constructor. The advantage of using prototypes is that the object instance can share the properties and methods it contains. That is, instead of adding definition object information to the constructor, you can add that information directly to the prototype. The main problem with using constructors is that each method is created once in each instance. There are two types of values in JavaScript, the original value and the object value. Each object has an internal property prototype, which we usually call a prototype. The value of the prototype can be an object or null. If its value is an object, the object must have its own prototype. This forms a linear chain, which we call the prototype chain.
To put it simply, in JavaScript, whenever an object (function) is defined, the object contains some predefined properties. One of the properties of the function object is the prototype object prototype. When JS creates an object (whether an ordinary object or a function object), it has a built-in property called _ _ proto__, which is used to point to the prototype object prototype of the function object in which it was created. We call the chain with _ _ proto__ strung together until the Object.prototype.__proto__ is null.
The above is all the content of this article "what does it mean to face the prototype chain of objects and prototypes in front-end development?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.