判断一个对象中是否有指定属性

1 hasOwnProperty

var a  = {b:1}a.hasOwnProperty('b')
true
a.hasOwnProperty('c')
false

2 in

猜你喜欢

转载自www.cnblogs.com/guozongzhang/p/10823806.html
今日推荐