SyntaxFix
Write A Post
Hire A Developer
Questions
Consider the array a:
var a ={'name1':1, 'name2':2}
If you want to check if 'name1' exists in a, simply test it with in:
in
if('name1' in a){ console.log('name1 exists in a') }else console.log('name1 is not in a')