Common objects and function objects

Object forms in JS are divided into ordinary objects and Function objects. Objects created by new Function() are Function objects, and other objects are ordinary objects

Prototype objects and __proto__

Prototype Object: Each function has the Prototype property, which is a pointer to an Object that defaults to an empty Object

Each prototype object has a constructor property, which points to the function itself

Each instance object has a __proto__ that can be called an implicit prototype, and its value refers to the prototype object

Prototype chain

The prototype object of each object is an object, and the object of the prototype object is still an object, and so on, forming the prototype chain

Object.prototype.__proto__    ————————–   null

function fn() {}  

fn.__proto__ === Function.prototype

Prototype === function.__proto__ // Function is also a Function object

Function.__proto__.__proto__ === Object.prototype