JS Object-Oriented composition is
1. Properties
2. Methods
It is used to add attributes to the constructor and add the method to the prototype.
If it is directly inside the constructor: passing a value, creating a new object, adding a property/method, or returning an object can cause problems, mainly
1. No new
2, the function repeats the definition, this can let the resources waste
So, we're going to use this construct property inside the constructor to put the method in the prototype.
If we rewrite the process-oriented function as an object-oriented function, we need to solve the function nesting, then transform the variable into a property, convert the function into a method,
Call to New.
Assuming b inherits a, if the method that does not let B increase first also affects a, the method of inheritance is as follows
for (var in a.prototype) { = a.prototype[i];}
JS Object-Oriented notes