How JavaScript uses a 2-D array

Source: Internet
Author: User
Reader_1»
<script>
var a=new Array ();
A[1]=new Array ("A", "B");
...
</script> reader_2»
<script language= "JavaScript" >
<!--
var a = new Array ();
A[0] = new Array ("A", "B");
A[1] = new Array ("C", "D");
Alert (a[1][1]);
-->
</script>
Reader_3»
var arr = new Array ([1,2,3],[4,5,6],[7,8,9,10]);
for (Var e in arr) alert (arr[e]);
Reader_4»
JScript is available with VBArray reader_5»
Declare an array first:
A=new Arrray (First_num);
Again is:
A[first_num]=new Array (number);
A[first_num]=new Array (number);
......
......
First_Name is a dimension,
Number can come in accordance with your needs.
This will create a multidimensional array.
:)) reader_6»
<script>
T=new Array;
T[1]=new Array;
T[1][0]= "a";
T[1][1]= "B";
Alert (t[1][0]);
</script> reader_7»
Add: Alert (t[1]); Reader_8»
<script>
var result = new Array (new Array ("1", "1111"),
New Array ("2", "2222"), New Array ("3", "3333"),
New Array ("4", "4444"));
for (var i=0;i< result.length;i++) {
Alert (result[i][0]+ "|") +RESULT[I][1]);
}
</script>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.