I have a 2d array that I created like such:
var images = new Array(50);
Now I would like to push values into this array, but I can't get the proper syntax to work. How would I for example convert these statements:
into a push statement (regardless of position pushed into array)?
n = images.length;
I was kind of hoping the result wouldn't expand my code...
So it can't be done in one line? You can't push an array into an array?
Stereofrog when I executed that code it worked (or at least it didn't throw any errors), but my notation for retrieving elements, images[x], images[x], images[x] doesn't return anything. In fact if I try to alert(images) nothing pops up at all.
var images = ;
images.push(["a", "b", "c"]);
images.push(["x", "y", "z"]);
alert(images); // b
alert(images); // x
Ah, thanks. I guess it was creating a 3d array because I still had the for loop to fill the array with arrays.
This topic is now closed. New replies are no longer allowed.