This thread on Javascript Arrays is quite good. And incredibly informative. It might be one of the best walkthroughs of Objects in Javascript that I’ve read. I highly recommend going and reading through it. At least cover the first page fairly well.
Just to dispel any misconceptions, there’s no such thing as an associative array in ECMAScript/Javascript. What you are actually using is a feature of objects - their ability to have properties added at run-time.
> var users = new array();
> users["joe"] = "Joe Blow";
> users["john"] = "John Doe";
> users["jane"] = "Jane Doe";
Using an actual array is a waste. You aren’t using it to store values by ordinal number, you’re just using the fact that it’s an object.
Just some really interesting stuff. Well worth your time. And for more Javascript goodness, I’ll toss out the JavaScript FAQ, the comp.lang.javascript group.
Tagged As Javascript
Comments are Open (0)
Posted at 11:44 AM