Don't use an array if you want named keys, use a plain object.
var a = {}; a["key1"] = "value1"; a["key2"] = "value2";
Then:
if ("key1" in a) { // something } else { // something else }
1.4m articles
1.4m replys
5 comments
57.0k users