function Parent() {
this.color = ['red','green'];
}
Parent.prototype.sayHello = function() {
console.log('Hello from parent');
}
function Child() {
}
Child.prototype = new Parent(); //继承了parent
let child = new Child();
child.sayHello(); // Hello from parent
child.color.push('black','pink');
console.log('child:'+child.color);//"child:red,green,black,pink"
let child2 = new Child();
console.log('child2:'+child2.color);// "child2:red,green,black,pink"