息壤

导航

 

2012年7月25日

摘要: JS中原型的概念不想多说,这里只是探讨一下修改父类原型属性与覆盖父类原型中属性的区别,防止以后出问题! 我们先看一段传统的继承代码://定义超类function Father(){ this.name = "父亲";}Father.prototype.theSuperValue = ["NO1","NO2"];//定义子类function Child(){}//实现继承Child.prototype = new Father();//修改共享数组Child.prototype.theSuperValue.push("修改&q 阅读全文
posted @ 2012-07-25 11:31 息壤 阅读(1116) 评论(8) 推荐(0) 编辑