1. JavaScript does not provide a way to directly define a two-dimensional array, but you can define a JavaScript two-dimensional array by using an array of defined arrays: for example, defining a 4x3 two-dimensional array A can take the following approach:
var a=new Array ();
A[0]=new Array ();
A[1]=new Array ();
A[2]=new Array ();
A[3]=new Array ();
Here is a case
Copy Code code as follows:
<! DOCTYPE html>
<meta http-equiv= "Con Tent-type "content=" text/html; Charset=utf-8 "/>
<title></title>
<body>
<script type=" text/ JavaScript >
Function func () {
var mXn = new Array (8);
for (var i = 0; i < 8; i++) {
Mxn[i] = new Array ();
for (Var j=0;j<8;j++)
{
mxn[i][j]= "" +i+ "Row" +j+ "column";
}
document.write ("<table border=\" 1\ "width=\" 700\ ">");
for (var i = 0; i < 8; i++) {
document.write ("<tr>");
for (var j = 0; J < 8; J + +) {
document.write ("<td>");
document.write (Mxn[i][j]);
document.write ("</td>");
}
document.write ("</tr>");
}
}
func ();
</script>
</body>