部分参考自:https://www.cnblogs.com/shytong/p/5100426.html 最近福报太多,又是一个撸码的周末,博客更新有点慢。 虽然没什么人看但是当初立下的flag还是得尽量实现~
1.工厂模式 function objectFactory(name,age){ var obj = {}; obj.name = name; obj.age = age; return obj; } var obj = objectFactory("obj",20); //
1.原型链继承 // 父类 function Parent(){ this.name = "Parent"; this.age = 40; this.extraInfo = { job: "Coder" }; }; Parent.prototype.say = functio