/* 组合方式实现继承:构造函数、原型链 */ function Parent3() { this.name = 'Parent 的属性'; this.arr = [1, 2, 3]; } function Child3() { Parent3.call(this); //【重要1】执行 parent方法 this.type = 'Child 的属性'; } Child3.prototype = new Parent3(); //【重要2】第二次执行parent方法 var child = new Child3();
来源:https://www.cnblogs.com/weichenji0/p/12631633.html