const obj = {
age:18,
name:'张三'
}
// 返回的布尔值
obj.hasOwnProperty('name')
// 或者使用 Object.prototype.hasOwnProperty
Object.prototype.hasOwnProperty.call(obj , 'name')
const obj = {
age:18,
name:'张三'
}
// 返回的布尔值
obj.hasOwnProperty('name')
// 或者使用 Object.prototype.hasOwnProperty
Object.prototype.hasOwnProperty.call(obj , 'name')