As we all know, hard work is the only way to success!
② All functions have a prototype attribute, and the attribute value is an ordinary object
③ Of all reference types__ proto__ Property points to the prototype of its constructor
var a = [1,2,3];
a.__proto__ === Array.prototype; // true
2、 Prototype chain
When accessing a property of an object, you will first find it on the property of the object itself,
If you don’t find it, you’ll go to it__ proto__ Search on the implicit prototype, that is, the prototype of its constructor,
If it is not found, it will be in the prototype of the constructor__ proto__ Find in,
In this way, looking up layer by layer will form a chain structure, which is called prototype chain.
For example, there are the following codes:
this.month = month;
var child = new Parent(‘Ann’);
console.log(child.month); // Ann
console.log(child.father); // undefined