应该这样吧
var myarr=new Array();
for(var i=0;i<5;i++){
myarr[i]=new Array();
for(var j=0;j<6;j++){
myarr[i][j]=i*j;
document.write(myarr[i][j]+" ");
}
document.write("</br>");
}
翻译
搜索
复制
var myarr=new Array();
for(var i=0;i<5;i++){
myarr[i]=new Array();
for(var j=0;j<6;j++){
myarr[i][j]=i*j;
document.write(myarr[i][j]+" ");
}
document.write("</br>");
}
翻译
搜索
复制
2023-08-24
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>二维数组示例</title>
<script type="text/javascript">
var myarr = new Array();
for (var i = 0; i < 5; i++) {
myarr[i] = new Array();
for (var j = 0; j < 6; j++) {
myarr[i][j] = i * j;
document.write(myarr[i][j] + " ");
}
document.write("<br>");
}
</script>
</head>
<body>
</body>
</html>
举报