📜  不要从目标对象访问 Object.prototype 方法“hasOwnProperty” - 无论代码示例

📅  最后修改于: 2022-03-11 14:56:29.093000             🧑  作者: Mango

代码示例1
let events = {"some-index": false};
let key = "some-index";

if(Object.prototype.hasOwnProperty.call(events, key)) {
    // This would compile without any issue !
    console.log("The object has the property");
}