How to output a two-dimensional array with 4 rows and 3 columns in JavaScript

青灯夜游
Release: 2021-10-28 16:01:12
Original
3799 people have browsed it

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

How to output a two-dimensional array with 4 rows and 3 columns in JavaScript

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] ];
Copy after login

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:

Copy after login

Output result:

How to output a two-dimensional array with 4 rows and 3 columns in JavaScript

[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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
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!