javascript if array key exists
snippet in javascript

javascript if array key exists

user8636

var person={"name":"Billy","age":20}
person.hasOwnProperty("name"); // true
person.hasOwnProperty("sex"); // false

javascript hashtable contains key

user5548

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

check if a key exists in an object javascript

user7183

"key" in obj // true, regardless of the actual value