1. ECMA-262 defines an object as a collection of unordered properties whose properties can contain basic values, objects, and functions. Each object is created based on a reference type.
2. There are two types of attributes: Data properties and accessor properties, where accessor properties cannot be defined directly and must be defined using Object.defineproperty ().
3. Any function, as long as it is called by the new operator, can be used as a constructor.
4. Prototype: Whenever a new function is created, a prototype attribute is created for the function based on a specific set of rules, which points to the prototype object of the function.
This connection exists between the instance and the constructor's prototype object, not between the instance and the constructor.
When the code reads a property of an object, the object instance itself is searched, and if a property with the given name is found in the instance, the property value is returned, and if it is not found, the search continues for the property in the prototype object pointed to by the pointer.
5. The connection between the instance and the prototype is a pointer, not a copy.
6. If the prototype is modified to another object, it is tantamount to cutting off the connection between the constructor and the original prototype.
7. Currently the most widely used method of creating custom classes in ECMAScript is constructors and prototype compositing patterns.
8. Relationship of constructors, prototypes, and instances: each constructor has a prototype object, and the prototype object contains a pointer to the constructor, and the instance contains an internal pointer to the prototype object.
8. Inheritance: ECMAScript only supports implementation of inheritance, does not support interface inheritance, and its implementation of inheritance is mainly dependent on the prototype chain.
JavaScript Learning Note Eight: Object-oriented Programming