function Parent () {
this.name = 'Parent';
this.play = [1, 2, 3];
}
function Child () {
Parent.call(this);
this.type = 'Child';
}
Child.prototype = new Parent();
let s = new Child();
let s1 = new Child();
s.play.push(4);
console.log(s.play, s1.play);
s 实例对象
s1 实例对象
网友评论