js has three kinds of memory One is function second is the stack of functions Three is the object or heap each has a feature there are many heaps every function is working on a heap It can add an object that can be referenced on this heap (through this. Variable =xxx) or use parent heap (via __proto__) object has child objects as if a forest with countless objects and function objects (tree structure) each object created has __ Proto__, which points to its inherited objects, objects through the __proto__ chain can inherit the methods of other objects and instances of members, which can be easily migrated to other object branches in a browser environment where window represents the root of all heaps (function () {...}) () These writes can create an anonymous heap of this anonymous heap hanging in the nearest heap of sub-heaps to avoid contamination functions can be added by prototype (such as function name. prototype. =function ()) and transformation Constructors ( Prototype.constructor) So functions can also be built into a forest so functions can build a lot of things under prototype The prototype of the object function of the prototype pointer function also has a constructor function representation constructor So the prototype of the constructor function to the function function is equivalent to the parent space of the function. The function can inherit a sub-function by "prototype. =function () {}" in the name of a functor can also be passed "function name. Prototype= an Object" To inherit all the member names and methods of an object so the essence of __proto__ and prototype is the same, which means that the parent space is just a function of the object, one acting on the functions, but the function is only at the time of the operation of the value, so there is a very big difference apply,call,bind can let a function use an object heap branch stack is growing and cutting in the run one function cannot use the stack of another function via new or object.create can Create a function to convert to an object or heap new execute this function operate on this heap summarize: JS can build a forest of objects and functions, canTo easily migrate objects and function branches, compare similar lisp recommended reading: Https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators /thishttps://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/object/prototype
JS essence theory