<!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>
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])放到循环结束之后即可。