1// declaration of a two-dimensional array
2// 5 is the number of rows and 4 is the number of columns.
3const matrix = new Array(5).fill(0).map(() => new Array(4).fill(0));
4
5console.log(matrix[0][0]); // 0
6
1var iMax = 20;
2var jMax = 10;
3var f = new Array();
4
5for (i=0;i<iMax;i++) {
6 f[i]=new Array();
7 for (j=0;j<jMax;j++) {
8 f[i][j]=0;
9 }
10}
11
1var items = [
2 [1, 2],
3 [3, 4],
4 [5, 6]
5];
6console.log(items[0][0]); // 1
7console.log(items[0][1]); // 2
8console.log(items[1][0]); // 3
9console.log(items[1][1]); // 4
10console.log(items);