myObj.hasOwnProperty('key') // it checks object for particular key and not on prototype
if ('key' in myObj)
// better
if (!myObj.hasOwnProperty('key'))
if('key' in object)
console.log("key" in obj)
Object.prototype.hasOwnProperty()
Object.prototype.hasOwnProperty.call(object, key)