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