Home > Web Front-end > JS Tutorial > body text

What is the prototype chain of js?

藏色散人
Release: 2020-09-17 10:32:13
Original
11021 people have browsed it

What is the prototype chain of js?

Each constructor has a prototype object. The prototype object contains a pointer to the constructor, and the instance contains a pointer to the inside of the prototype object. We make the instance of the prototype object (1) equal to another prototype object (2). At this time, the prototype object (2) will contain a pointer to the prototype object (1), and then let the instance of the prototype object (2) equal the prototype object ( 3). Such layer-by-layer progression forms a chain of instances and prototypes. This is the concept of prototype chain.


In other words, each constructor has a prototype object, and each constructor instance contains an internal pointer (proto) pointing to the prototype object. If we let the The prototype object of one constructor is equal to the instance of the second constructor. As a result, the prototype object of the first constructor will contain a pointer to the second prototype object, and then the third prototype object is equal to the first constructor. instance, so that the third prototype object will also contain a pointer to the first prototype object, and so on, it is enough to form a chain of instances in the prototype. This is the basic concept of the prototype chain.

The above is the detailed content of What is the prototype chain of js?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!