A figure instantly shows the prototype chain structure

Source: Internet
Author: User

A figure instantly shows you the prototype chain structure: 78553716

 

Before looking at the figure, we will first learn the basic knowledge of several object prototypes:
Example:
Function FN () {}// FN is the constructor
VaR F1 = new FN (); // F1 is the object created by the FN constructor.
The prototype attribute value of the constructor is the object prototype. (Fn. prototype is the prototype of the object)
The type of the prototype attribute value of the constructor is the object typeof fn. Prototype = object.
The constructor attribute in the object prototype points to the constructor (fn. Prototype. constructor === FN)
The _ PROTO _ attribute value of an object is the prototype of the object. (F1. _ PROTO _ is the object prototype)
FN. Prototype = F1. _ PROTO _ in fact, both of them are the same object-the prototype of the object.
All fn. Prototype. _ PROTO __== object. Prototype
Typeof object. Prototype = object.
Object. Prototype. _ PROTO __= = NULL.

I will discuss the relationship between the prototype object and the prototype object. The prototype chain is also called the object chain.
With the above basic knowledge, you can see the prototype chain diagram below.

Therefore, the prototype chain of object F1 is F1. _ PROTO _ ----> fn. Prototype. _ PROTO _ -----> object. Prototype. _ prototype _ ----> null.

A figure instantly shows the prototype chain structure

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.