js dictionary contains key 1

js dictionary contains key

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

Here is what the above code is Doing:
1. We create an object called person.
2. We check if the person object has a property called name.
3. We check if the person object has a property called sex.

Similar Posts