继承

function Mother(age){
this.age=age;
this.num=["hello","world"];
}
Mother.prototype.printage=function(){
console.log(this.age);
}

function Person(name,age){

Mother.call(this,age);
this.name=name;

}

Person.prototype=new Mother();
Person.prototype.constructor=Person;

Person.prototype.printname=function(){
console.log(this.name);
}

var p1=new Person("jack",20);
p1;

上面的理解下 继承

分为组合继承 分为
1 组合继承
2 寄生组合继承

寄生组合继承理解有点问题

原文地址:https://www.cnblogs.com/liuestc/p/5483973.html