标签: javascript
示例:
var o = {'key': 'value'}; var key = 'key'; console.log('key' in o); //true console.log(key in o); //false
怎么做? =)
答案 0 :(得分:5)
我建议:
o.hasOwnProperty(key);
JS Fiddle demo
参考文献:
hasOwnProperty()
答案 1 :(得分:3)
尝试hasOwnProperty:
hasOwnProperty