Javascript array with custom variable indexing
I think what you want is:
var indexID = 5;
var temp = {};
temp[indexID] = "stuff"
Yes, just use square brackets notation:
var temp = {};
temp[indexID] = [];
Also pay attention to the fact that temp
is an object, and not an array. In JavaScript all associative arrays (or dictionaries) are represented as objects.
MORE: http://www.jibbering.com/faq/faq_notes/square_brackets.html#vId