js如何实现组合继承?
网友回复
// 基类 var Person = function (name, age) { this.name = name; this.age = age; }; Person.prototype.test = "this is a test"; Person.prototype.testFunc = function () { console.log('this is a testFunc'); }; // 子类 var Student = function (name, age, gender, score) { // 盗用构造函数 Person.call(this, name, age); this.ge...
点击查看剩余70%