摘要:
//动态原型模式function Box(name,age){ this.name = name; this.age = age; this.family = ['哥哥','姐姐','妹妹']; if(typeof this.run != 'function'){ ... 阅读全文
摘要:
//组合构造函数+原型模式function Box(name,age){ //保持独立的用构造函数 this.name = name; this.age = age; this.family = ['哥哥','姐姐','妹妹']};Box.prototype ... 阅读全文
摘要:
//原型创建对象function Box(){};Box.prototype.name = 'Lee';Box.prototype.age = 100;Box.prototype.run = function(){ return this.name + this.age + 'running.... 阅读全文
摘要:
//构造函数创建对象function Box(name,age){ //创建一个对象 this.name = name; //添加一个属性 this.age = age; this.run = function(){ return this... 阅读全文