1. Basic Concepts
Javascript all objects are divided into function objects and normal objects. Each object has a __proto__ attribute, and only function objects have a Prototype attribute
Each function object has a prototype (display prototype), and each instance object has a __proto__ (implicit prototype), whose value is the display prototype of its corresponding constructor
Each function has a Prototype property that, by default, points to an empty Object. The prototype Object has a constructor property that points to the function Object and adds properties (methods) to the prototype Object. All instances of the function automatically have properties (methods) from the prototype.
Second, code understanding
// Instance object
f1.__proto__ = Fn.prototype
// constructor
Fn.prototype.constructor = Fn
Fn.__proto__ = Function.prototype
Fn.prototype.__proto__ = Object.prototype
// Object
Object.prototype.constructor = Object
Object.prototype.__proto__ = null
Object.__proto__ = Function.prototype
// Function
Function.prototype.constructor = Function
Function.__proto__ = Function.prototype
Function.prototype.__proto__ = Object.prototype
Copy the code