SOURCE

let Parent = function(){
    this.colors = ['red','green','blue','black']
}
let  Son = function(){}
Son.prototype =new Parent;
let son1 = new Son;
son1.colors.unshift('white');
console.log(son1.colors);
let son2 = new Son;
console.log(son2.colors);

// 盗用构造函数
let Parent2 =function(){
    this.food = ['chicken','beef','milk','apple'];
}

let Son2 =function(){
    Parent2.call(this); //传入子类构造函数的this
    //子类调用父类的构造函数
}

let son3 = new Son2;
son3.food.unshift('onion');
console.log(son3.food);
let son4 = new Son2;
console.log(son4.food);

// 组合继承
console 命令行工具 X clear

                    
>
console