Since now, I'm using this loop to iterate over the elements of an array, which works fine even if I put objects with various properties inside of it.
var cubes[];
for (i in cubes){
cubes[i].dimension
cubes[i].position_x
ecc..
}
Now, let's suppose cubes[] is declared this way
var cubes[][];
Can I do this in Javascript? How can I then automatically iterate in
cubes[0][0]
cubes[0][1]
cubes[0][2]
cubes[1][0]
cubes[1][1]
cubes[1][2]
cubes[2][0]
ecc...
As a workaround, I can just declare:
var cubes[];
var cubes1[];
and work separately with the two arrays. Is this a better solution?
See Question&Answers more detail:os