how to check if object has key javascript

JavaScript
myObj.hasOwnProperty('key') // it checks object for particular key and not on prototype   if ('key' in myObj)
Source

Also in JavaScript: