hasOwnProperty()方法可以检测对象是否有某个属性
var man = { legs:2, hands:2, heads:1 } man.hasOwnProperty("heads") //true
hasOwnProperty()不能检测原型链上的属性
hasOwnProperty()方法可以检测对象是否有某个属性
var man = { legs:2, hands:2, heads:1 } man.hasOwnProperty("heads") //true
hasOwnProperty()不能检测原型链上的属性
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。