摘要:
一、原型链继承 // 父类型 function Father(name){ this.name = name; } Father.prototype.showFatherName = function(){ console.log(this.name); }; // 子类型 function Chi 阅读全文
摘要:
一、工厂模式 function createPerson(name, age){ var obj = new Object(); obj.name = name; obj.age = age; obj.display = function(){ alert(this.name); }; return 阅读全文