JavaScript jika ada kunci array
var person={"name":"Billy","age":20}
person.hasOwnProperty("name"); // true
person.hasOwnProperty("sex"); // false
Grepper
var person={"name":"Billy","age":20}
person.hasOwnProperty("name"); // true
person.hasOwnProperty("sex"); // false
if (obj.hasOwnProperty("key1")) {
...
}
"key" in obj // true, regardless of the actual value