system — 2007-05-28T04:08:18-04:00 — #1
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)?
felgall — 2007-05-28T04:38:13-04:00 — #2
n = images.length;
system — 2007-05-28T05:21:49-04:00 — #3
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 — 2007-05-28T06:07:42-04:00 — #4
system — 2007-05-28T12:36:03-04:00 — #5
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.
dougbtx — 2007-05-28T12:49:59-04:00 — #6
var images = ;
images.push(["a", "b", "c"]);
images.push(["x", "y", "z"]);
alert(images); // b
alert(images); // x
system — 2007-05-28T13:27:13-04:00 — #7
Ah, thanks. I guess it was creating a 3d array because I still had the for loop to fill the array with arrays.