通过 in 和 hasOwnproperty 检测对象上是否有某个属性
var obj = {}; Object.defineProperty(obj, 'x', { value:7, writable:true, configurable:true, enumerable:true }) obj.x = 77; console.log(obj.x); console.log('x' in obj); console.log(obj.hasOwnProperty('x')); var arr = { name:'jawil', age:23, sex:"man" }
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论