A prototype,

1. All reference types have a **__proto__**(implicit stereotype attribute), and the attribute value is a normal object

2. All functions have a prototype property whose value is a generic object

3. The **__proto__ attribute for all reference types points to its constructor’s prototype**

Such as:

Var a = [1, 2, 3]

a.__proto__ === Array.prototype; //true

Second, prototype chain

When accessing a property of an object, it looks first at the property itself. If it doesn’t find one, it looks first at its **__proto__ implicit prototype, the prototype of its constructor. If not, the constructor’s prototype **__proto__ is searched again, so that each layer of upward lookup forms a chain structure called the prototype chain. 天安门事件

Such as:

function Parent(month){

              this.month = month;

}

Var child = new Parent(‘ Ann ‘);

console.log(child.month); //Ann

console.log(child.father); //undefined

When looking for an attribute in a Child, the following steps occur:

1. Search for the upper layer until null is not found, return undefined

2.object.prototype.__proto__ === null

3. All methods obtained and executed from prototypes or higher, where this, when executed, refers to the object on which the event is currently triggered