object contain key javascript code example
Example 1: check object has key javascript
Object.prototype.hasOwnProperty()
Example 2: js object contain key
if ('key' in myObj)
// better
if (!myObj.hasOwnProperty('key'))
Object.prototype.hasOwnProperty()
if ('key' in myObj)
// better
if (!myObj.hasOwnProperty('key'))