Something that JavaScript appears to be lacking that is often available in other programming languages is a multidimensional Array object. In fact, though, you can get the same functionality by using Arrays full of Arrays!

There's a little bit of extra legwork involved - namely, you have to make sure you create all your Array objects before you try and access them. The Create2DArray() function below can be used to initialize a 2-dimensional array.

function Create2DArray(rows, columns)
  var arr = new Array(rows);
  for (var i = 0; i < rows; i++) {
    arr[i] = new Array(columns);
  return arr;

my2DArray = Create2DArray(4, 15);

for (var i = 0; i < 4; i++) {
  for (var j = 0; j < 15; j++) {
    my2DArray[i][j] = i * j;