I realize this is an old question, but it pops up in Google when you search for 'javascript dictionaries', so I'd like to add to the above answers that in ECMAScript 6, the official Map
object has been introduced, which is a dictionary implementation:
var dict = new Map();
dict.set("foo", "bar");
//returns "bar"
dict.get("foo");
Unlike javascript's normal objects, it allows any object as a key:
var foo = {};
var bar = {};
var dict = new Map();
dict.set(foo, "Foo");
dict.set(bar, "Bar");
//returns "Bar"
dict.get(bar);
//returns "Foo"
dict.get(foo);
//returns undefined, as {} !== foo and {} !== bar
dict.get({});