I\'m trying to create an associative array, create an empty array, and then add a (indexName
-> value) pair:
var arrayName = new Array;
arrayName[\
use arrayName[var1+var2]
Note that arrayName.var
is the same as arrayName["var"]
-- it's just syntactic sugar. The second form is mostly used when dealing with the kind of problems that you are facing - dynamic object keys, and keys that are not alphanumeric (think of arrayName[".eval()"]
; this is a perfectly legal object key that has nothing to do with the javascript eval()
function)