JS高级---逆推继承看原型
程序员文章站
2022-04-14 16:32:36
逆推继承看原型 function F1(age) { this.age = age; } function F2(age) { this.age = age; } F2.prototype = new F1(10); function F3(age) { this.age = age; } F3.p ......
逆推继承看原型
function f1(age) { this.age = age; } function f2(age) { this.age = age; } f2.prototype = new f1(10); function f3(age) { this.age = age; } f3.prototype = new f2(20); var f3 = new f3(30); console.log(f3.age);//