Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2D Array in JScript

Status
Not open for further replies.

PepperPepsi

Programmer
Joined
Aug 3, 2000
Messages
241
Location
US
Hi, can anyone please tell me how to create an 2D array in JScript?

thanks

Chiu Chan
cchan@gefmus.com
 
To create a 2D 3x3 array:
Code:
  myArray = new Array(2)
  myArray[0] = new Array(2)
  myArray[1] = new Array(2)
  myArray[2] = new Array(2)
To assign values to elements in the arrays:
Code:
  myArray[0][0] = "this"
  myArray[0][1] = "that"
You're actually creating an array within each element of the first array.

HTH

Choo Khor
choo.khor@intelebill.com
 
ChooKhor,

thanks for your reply,

however, that is in JavaScript, not JScript
Array[x][x] don't work for JScript

Chiu Chan
cchan@gefmus.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top