xxxxxxxxxx
if ('key' in myObj)
And the inverse.
if (!('key' in myObj))
Be careful! The in operator matches all object keys, including those in the object's prototype chain.
Use myObj.hasOwnProperty('key') to check an object's own keys and will only return true if key is available on myObj directly:
myObj.hasOwnProperty('key')