I have an object which contains a variable number of arrays. The property title always is a number (like here: 15, 117). I could simply access the arrays with names[15] or names[117], but those values are changing constantly because of a data-request.
How can I access them as "the first" or "the second"???
var names = {
15: Array[1];
117: Array[1];
};
If this isn't working, I tried a for...in loop to store the arrays in variables, but it didn't really work out:
var name1, name2;
for(var key in names){
if(name1){name2 = names[key];}
if(!name1){name1 = names[key];}
}
As soon as there are more arrays, it's overriding name1 with name2 and so on...
Any idea how to solve this? Thanks already for your time.
Arraysupposed to be here? Do you mean just some sample array, or did you really mean to use theArrayconstructor?