how to check if an object has a key or not in javascript code example
Example 1: check object has key javascript
Object.prototype.hasOwnProperty()
Example 2: javascript if object has key
if('key' in object)
Object.prototype.hasOwnProperty()
if('key' in object)