Why are there many ways to implement inheritance? I feel that it is very good to realize inheritance.

I can see that there are many ways to implement inheritance, such as combinatorial inheritance and parasitic inheritance, and some of them have many shortcomings. I feel that either the following or es6 can realize inheritance very well. Why are there any of the above methods

?
function Parent(name) {
  this.name = name
}
Parent.prototype.getName = function() {
  console.log(this.name)
}

function Child(name) {
  Parent.call(this, name)
  this.*** = ***
  ///
}
Child.prototype = Object.create(Parent.prototype)
child.prototype.fn = function***
///
Mar.28,2021

all come step by step with the development of the language.
Class is convenient but not before ES6, Object.create is convenient but not before ES5.


you can't say that your old friends don't want it when you grow up.
these are all problems left over by history.

Menu