Home >Web Front-end >JS Tutorial >Definition of JS two-dimensional array_javascript skills

Definition of JS two-dimensional array_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 16:57:361430browse

1. The way to declare a two-dimensional array is as follows:
var images=new Array();
//Declare one dimension first
for(var i=0;i<10;i ){
//One-dimensional length is 10 images[i]=new Array();
//Declaring two-dimensional for(var j=0;j<20;j ){
// The two-dimensional length is 20 images[i][j]=1; } }

2. The way to use the secondary array should be like this: alert(images[0][0]);

Statement:
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