2014年4月9日

[js方法pk]之instanceof() vs isPrototypeOf() hasOwnProperty() vs propertyIsEnumerable()

摘要: 这几个方法在js的高级编程中经常用到,对于新手来说可能还不知道他们有什么区别,我把我的体会总结下来,供大家参考:首先,定义一个对象: 1 function Parent() {this.name = "wenbo";} 2 Parent.prototype.alertP = function() { 3 alert("Parent"); 4 } 5 6 function Child() {this.age = 23;} 7 Child.prototype.alertC = function() { 8 alert("Child"); 阅读全文

posted @ 2014-04-09 14:55 wenber 阅读(1090) 评论(1) 推荐(3) 编辑

导航