JS检查属性是否存在对象中

113 阅读1分钟

推荐使用:

Object.prototype.hasOwnProperty.call(目标对象,所判断字段)

简化写法:

Object.hasOwn(目标对象,所判断字段)