摘要:
//使用原型工厂封装继承 function extend(sub,sup){ sub.prototype=Object.create(sup.prototype); Object.defineProperty(sub.prototype,"constructor",{ value:sub, enum 阅读全文
摘要:
//使用原型工厂封装继承 function extend(sub,sup){ sub.prototype=Object.create(sup.prototype); Object.defineProperty(sub.prototype,"constructor",{ value:sub, enum 阅读全文
摘要:
function User(name,age){ this.name=name; this.age=age; } User.prototype.show=function(){ console.log(this.name,this.age); } function Admin(...args){ / 阅读全文
摘要:
function Admin(){ Admin.prototype.showAdmin=function(){ return "admin"; } } function Enterprise(){ Enterprise.prototype.showEnterprise=function(){ ret 阅读全文
摘要:
function User(){} User.prototype.name=function(){ console.log("user.name"); } function Admin(){} //方式1 //Admin.prototype.__proto__==Object.prototype c 阅读全文