I. The relationship between objects and functions
1. An object is a function creation, and a function is an object.
2. How objects are created
The 2.1.Object constructor creates an object, new objects ();
2.2. The literal creation of the object var x = new (), which is essentially created by the new object method.
2.3. Create from Factory mode, use new Object () in the method, you can create multiple objects.
2.4. Create an object using the constructor.
2.5. Create an object using a prototype.
2.6. Create an object using constructors and prototypes.
2.7 use Object.create (); Create object.
3. Functions, objects, prototypes, prototype chains
1. Each function has a prototype, and each object has a __proto__.
2.__proto__ (implicit prototypes) and prototype (explicit prototypes).
Implicit prototypes: Each function will have a property named prototype after it is created, which points to the prototype object of the function.
Display prototypes: Any object in JavaScript has a built-in property [[prototype]] and there is no standard way to access this built-in property before ES5, but most browsers support access through __proto__.
Relationships: Implicit prototypes point to Prototype (display prototypes) of functions that create this object (constructor)
Role: The role of explicit prototypes: used to implement prototype-based inheritance and attribute sharing, the role of implicit prototypes: forming a prototype chain, also used to implement prototype-based inheritance. For example, when we visit the X attribute in obj, if it is not found in obj, it will be searched along the __proto__.
JavaScript prototypes and prototype chains