Answers for "jquery key exists in array"

16

javascript if array key exists

var person={"name":"Billy","age":20}
person.hasOwnProperty("name"); // true
person.hasOwnProperty("sex"); // false
Posted by: Guest on July-22-2019
0

jquery if key exists in object

Use the in operator:

testArray = 'key1' in obj;
Sidenote: What you got there, is actually no jQuery object, but just a plain JavaScript Object
Posted by: Guest on March-20-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language