| Author |
Multi-Dimensional Array
|
L Tran
Greenhorn
Joined: Jun 06, 2012
Posts: 7
|
|
I have an array, called, "myArray". Inside this myArray are 4 more arrays, "m0, m1, m2, m3".
How do I access all the elements in all the array?
Here's my code, :
This code only give me the first 2 elements in each array.
But, I would like to get all the elements in all the arrays.
tks
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56543
|
|
Think about this expression for a few minutes: ("m"+i).length;
What is it that you think it is going to give you?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15362
|
|
Why don't you actually make a 2D array instead of using variables?
The reason why your code fails is you can not build a magical string and expect it to become a variable!
Run this in firebug:
Again, it is better to define it as one array, not multiple variables
|
 |
 |
|
|
subject: Multi-Dimensional Array
|
|
|