Randy said:
The only problem being that JS has no "associative arrays".
I agree that JS does not explicitly implement a data structure called
an "associative array". However, being such an expressive language, JS
objects can definitely be used as a collection of name/value pairs,
which I don't have a problem referring to informally as an associative
array. Not to mention that this is significantly more meaningful to
someone coming from a PHP background.
I thought it was obvious that in my previous post I was referring to a
feature in JS which is commonly referred to as an "associative array"
for simplicity in explanations. Notice how I said "pretend", and notice
I quoted the words "associative arrays", and notice how I said to use a
JS object, which is how JS implements what is known as an associative
array in other languages.
Just to clarify things, when I referred to using a JS object as a
pretend associative array, I was referring to the technique described
on the following site (someone may have a better link):
http://www.unix.org.ua/orelly/web/jscript/ch07_06.html
FYI: An interesting application of JS objects used in this way (in
combination with an initialization syntax/notation) is JSON:
http://www.crockford.com/JSON/index.html