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