if variable is a key in an object javascript code example
Example 1: js object contain key
if ('key' in myObj)
// better
if (!myObj.hasOwnProperty('key'))
Example 2: javascript if object has key
if('key' in object)
if ('key' in myObj)
// better
if (!myObj.hasOwnProperty('key'))
if('key' in object)