JavaScript 的六种继承方式
文章目录原型链继承借用构造函数继承组合继承原型式继承寄生式继承寄生组合式继承原型链继承function Parent() { this.name = 'Harry' // arr 被所有实例化对象共享 this.arr = [1, 2, 3]}Parent.prototype.sayName = function () { console.log(this.name)}// 创建 Child 实例时,不能向 Parent 传参function Child() {}Child







