check if key exists on object javascript code example
Example 1: javascript hashtable contains key
if (obj.hasOwnProperty("key1")) {
...
}
Example 2: js check if object key exists
var obj = { key: undefined };
obj["key"] !== undefined // false, but the key exists!