check if a key exists in an object javascript

JavaScript
if (obj.hasOwnProperty("key1")) {
  ...
}"key" in obj // true, regardless of the actual value
Source

Also in JavaScript: