求解,为啥没结果
面对疾风吧
面对疾风吧 2016-12-21 11:50:09
0
2
874
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>二维数组</title>
<script type="text/javascript">
var myarr=new Array();
 for (var i=1;i<4;i++)
 {
     myarr[i]=new Array();
     for(var j=1;j<7;j++){
         myarr[i][j]=i*j
     document.write(myarr[2][5])
     }
     }
</script>
</head>
<body>
</body>
</html>
面对疾风吧
面对疾风吧

reply all(2)
数据分析师

Solution, why there is no result-PHP Chinese website Q&A-Solution, why there is no result-PHP Chinese website Q&A

Look around and learn.

巴扎黑

当 i=1 时就输出了myarr[2][5],这个时候还没有myarr[2][5],把document.write(myarr[2][5])放到循环结束之后即可。

var myarr=new Array();
 for (var i=1;i<4;i++)
 {
     myarr[i]=new Array();
     for(var j=1;j<7;j++){
         myarr[i][j]=i*j;     
     }
}
document.write(myarr[2][5]);

   


Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!