1. Prototype chain
Using prototypes to let one reference type inherit the properties and methods of another reference class
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.
Example:
2. Borrowing constructors
The superclass constructor is called inside the subtype constructor, and the constructor can be executed on the innovative object through the call () and the Apply () method
Example:
3. Combining inheritance
Combine the prototype chain and the technique of borrowing the constructor together to play the two-way inheritance pattern of Yi
Example:
4. prototype-Type Inheritance
Prototypes can be used to innovate objects based on existing objects without having to create custom types
Example:
5. Parasitic inheritance
Create a function that encapsulates the inheritance process, which internally enhances the object in some way, and then returns the object as if it did all the work.
Example
6. Parasitic combined inheritance
Inheriting attributes by borrowing functions, inheriting them through the compositing form of the prototype chain
6 ways in which JavaScript inherits