Video interview knowledge finishing 1-8 (prototype chain)

There are several ways to create an object?

    1) literal

    2) Constructor

    3)Object.create

Prototype chain (the relationship between the prototype constructor example, prototype chain)

instanceof principle:

 

Judgment is prototype __proto__ properties, and constructors points to an instance of an object is whether the address (Note: If the object is a unified address, then up the prototype chain will return to true) If you want to determine whether the instance which is an instance constructor, would be more rigorous with constructor

 

new operator:

1) creates a new object

2) will point to this new object

3) the constructor is executed code (added to the object attribute)

4) return the object (if the function has a return target is the return will be returned inside the object rather than the new object)

 

Guess you like

Origin www.cnblogs.com/llcMite/p/11105797.html