View Full Version : 2 dimensional arrays in Javascript
Michael
05-28-2004, 07:56 PM
Hi
is there anyway that I can create a 2 dimensional arrays in Javascript?
I urgently need it because I am working on a simulator to make my life easier when i will work on my math project
thanks
afterburn
05-28-2004, 09:16 PM
Nope... Sorry. Only 1 ....
Willy Duitt
05-28-2004, 09:36 PM
Originally posted by afterburn
Nope... Sorry. Only 1 ....
Yes there are, even three or four or five dimensional.
http://www.trans4mind.com/personal_development/JavaScript/Array2D.htm
afterburn
05-28-2004, 10:20 PM
I stand corrected. I was not aware of that before. Does not surprise me tho according to the docs was not available till 1.2 in NS. which is NS 6.
Thamior
05-29-2004, 12:40 AM
right the book I have s old and says you can't. however they say it can.
afterburn
05-29-2004, 08:17 AM
If you want to be backwards compatiable to javascript 1.0 that was in NS 2.0 then just create an offset single dimension array.
or create an array with arrays in it. Which is the way that the underlying computer handles multiple d's
//Note i+=3 is the steps so the array is [0][3] ...
for(i =0;i<ary.length;i+=3)
{
}
Michael
05-29-2004, 09:09 PM
thanks for the help, I will give it a try
vBulletin® v3.6.7, Copyright ©2000-2010, Jelsoft Enterprises Ltd.