javascript中对象的创建-原型模式2
摘要:
在上篇文章中,我们说过,原型对象也有缺点:function Person(){}Person.prototype={ name:"nUll", friends:["gay1","gay2"], sayName:function(){ alert(this.name); } };var person1=new Person();var person2=new Person();person1.friends.push("gay3");alert(person2.friends); //gay1,gay2,gay... 阅读全文
posted @ 2014-04-09 20:57 nU|| 阅读(230) 评论(0) 推荐(0) 编辑