in 与 hasOwnProperty的区别
in不仅会查找对象实例自身属性,还会查找其原型属性hasOwnProperty只会查找对象实例自身属性
let obj = {name: 'ys'}
Object.setPrototypeOf(obj,{action:'move'})
console.log('name' in obj) // true
console.log('action' in obj) // true
console.log(obj.hasOwnProperty('name'))//true
console.log(obj.hasOwnProperty('action'))//false