javascript does key exist

70

javascript hashtable contains key -

if (obj.hasOwnProperty("key1")) {
  ...
}

js check if object key exists -

var obj = { key: undefined };
obj["key"] !== undefined // false, but the key exists!

Comments

Submit
0 Comments