So überprüfen Sie, ob das Objekt einen Schlüssel -JavaScript hat
myObj.hasOwnProperty('key') // it checks object for particular key and not on prototype
Proud Pony
myObj.hasOwnProperty('key') // it checks object for particular key and not on prototype
if ('key' in myObj)
Object.prototype.hasOwnProperty()
Object.prototype.hasOwnProperty.call(object, key)
console.log("key" in obj)