SOURCE

function Parent(){
    this.name=['xiaoming','xiaohong'];
}

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

function Childern(){

}

Childern.prototype=new Parent();

let ch01=new Childern();
console.log(ch01.getName())
ch01.name.push('xiaodeng');
console.log(ch01.getName())
let ch02=new Childern();
console.log(ch01.getName())

/**
 * 缺点:
 * 1.引用类型的属性被所有实例共享
 * 2.创建Childern实例时不能向Parent传参
 */
console 命令行工具 X clear

                    
>
console