Example 1: how to declare 3d array in javascript
var myArray = [[[]]];
Example 2: javascript define multidimensional array
var iMax = 20; var jMax = 10; var f = new Array(); for (i=0;i<iMax;i++) { f[i]=new Array(); for (j=0;j<jMax;j++) { f[i][j]=0; } }
Example 3: multi-dimensional array js
var array = [ ["0, 0", "1, 0", "2, 0", "3, 0", "4, 0"], ["0, 1", "1, 1", "2, 1", "3, 1", "4, 1"], ["0, 2", "1, 2", "2, 2", "3, 2", "4, 2"], ["0, 3", "1, 3", "2, 3", "3, 3", "4, 3"], ["0, 4", "1, 4", "2, 4", "3, 4", "4, 4"], ]; console.log(array[3][3]);
Comments
Post a Comment