[Javascript] Two Dimensional Arrays

rhh ric_hod at terra.com.br
Sat Jun 16 23:46:57 CDT 2001

Or if ...myArray[0,1] = 5; etc
were not an acceptable syntax by the browser...

you can try:

var myArray = new Array;

myArray[0][1] = 5;
myArray[0][2] = 6;

or something like it:

regionalOffices[0] = new officeRecord("New York", "Shirley Smith", 300000)
regionalOffices[1] = new officeRecord("Chicago", "Todd Gaston", 250000)
regionalOffices[2] = new officeRecord("Houston", "Leslie Jones", 350000)
regionalOffices[3] = new officeRecord("Portland", "Harold Zoot", 225000)

And you can also index all the stuff with letters:

regionalOffices["east"] = new officeRecord("New York", "Shirley Smith",

and access the data via the same index:

var eastOfficeManager = regionalOffices["east"].manager
Ric Brasil

It's pretty simple; just like you'd expect (nice when that happens)...


var myArray = new Array;

myArray[0,1] = 5;
myArray[0,2] = 6;

alert(myArray[0,1] + " " + myArray[0,2]);




|-----Original Message-----
|From: javascript-admin at LaTech.edu [mailto:javascript-admin at LaTech.edu]On
|Behalf Of alkemist_111 at Euphorium.net
|Sent: Saturday, June 16, 2001 6:20 PM
|To: javascript at LaTech.edu
|Subject: [Javascript] Two Dimensional Arrays
|How to make a two dimensional Array in JavaScript(JScript).
|Urban Avierfjärd
|Homepage http://w1.201.telia.com/~u20100003
|Javascript mailing list
|Javascript at LaTech.edu

Javascript mailing list
Javascript at LaTech.edu

More information about the Javascript mailing list