ES6 继承例子:
class Child extends Parent {
constructor(firstName,lastName,age) {
super(firstName,lastName)
this.age = age
}
}
ES5的等价写法:
function Child(firstName,age) {
Parent.call(this,firstName,lastName)
this.age = age
}
Child.prototype = Object.create(Parent.prototype)
Child.constructor = Child