Write down the HTML and JavaScript:
A 3x3 2D array:
Arrays can have anything, even other arrays. In the JavaScript, 2D arrays are assigned with the single array, where each element consists of an array.
Explain a 2D array:
var matrix = new Array(numrows);
for (row = 0; row < numrows; row++)
matrix [row] = new Array(numcols);
Elements may be accessed with the [] just like with 1D array, however since each row in 2D array consists of an array, accessing with row, then column:
Matrix [row][col]
Initialize the 2D array by iterating over each row and each column:
for (row = 0; row < numrows; row++)
{
for(col = 0; col < numrows; col++)
matrix[row][col] = #
}