In JavaScript, you can use a double-layer for loop and write() to output a two-dimensional array with 4 rows and 3 columns. The syntax is "for(var i=0;i
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
JavaScript outputs a two-dimensional array with 4 rows and 3 columns
Here is a two-dimensional array with 4 rows and 3 columns:
var a = [ //定义二维数组 [1.1, 1.2, 1.3, 1.4], [2.1, 2.2, 2.3, 2.4], [3.1, 3.2, 3.3, 3.4] ];
Let’s take a look at how to output:
Method: Use a double-layer for loop
The outer for loop controls the number of rows, and the memory for Loop control column number
Implementation code:
Output result:
[Recommended learning :javascript advanced tutorial】
The above is the detailed content of How to output a two-dimensional array with 4 rows and 3 columns in JavaScript. For more information, please follow other related articles on the PHP Chinese website!