How can I implement an array with an indexer in JavaScript? Is there something like a dictionary in .Net?
Technically not, but you can use a regular JavaScript object like a dictionary:
var a = {"a":"wohoo", 2:"hello2", "d":"hello"}; alert(a["a"]); alert(a[2]); alert(a["d"]);
2.1m questions
2.1m answers
60 comments
57.0k users