如何检查对象是否在JavaScript中具有属性?
考虑:
x = {'key': 1}; if ( x.hasOwnProperty('key') ) { //Do this }
这是最好的方法吗?
javascript
javascript ×1