how to make 2D arrays in javascript
Posted: Thu Dec 01, 2005 3:37 pm
A basic way to make a 2D array 20 by 20 is like this:
Code: Select all
var UserBoard = new Array(20);
for(var i=0;i<=21;i++)
{
UserBoard[i]==new Array(20);
}
UserBoard[4,5]="test";
alert("test:" + UserBoard[4,5]);
[code]
Reason I'm posting this is just for reference purposes since I've been trying to do this for hours, thinking it was UserBoard[4][5] but it's UserBoard[4,5] that you access it by.
[color=#888888][size=85]Archived topic from Iceteks, old topic ID:3987, old post ID:32744[/size][/color]