class Parent{
constructor(){
this.age = 19;
}
}
class Child extends Parent{
constructor(){
super();
this.name = '自傲三';
}
}
function Parent(){
this.age = 19
this.run = function(){}
}
function Child(){
this.name = '张三'
}
Child.prototype = new Parent()
var o1 = new Child()
var o2 = new Child()
console.log( o1.run === o2.run )
function Parent(){
this.age = 19
this.run = function(){}
}
function Child(){
Parent.call(this)
this.name = '张三'
}
var o1 = new Child()
var o2 = new Child()
console.log( o1.run === o2.run )