Answers for "typescript do not access object.prototype method 'hasownproperty' from target object."

2

Do not access Object.prototype method 'hasOwnProperty' from target object

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");
}
Posted by: Guest on May-17-2021

Code answers related to "typescript do not access object.prototype method 'hasownproperty' from target object."

Browse Popular Code Answers by Language