Detailed explanation of JavaScript advanced Array (10)

Source: Internet
Author: User
This article describes the detailed explanation of the JavaScript advanced Array (10). For more information, see JS array details Array declaration methodArrayObj = new Array ();

// Create an array.

Var arr1 = new Array ();

ArrayObj = new Array ([size])

// Create an array and specify the length. Note that the length is not the upper limit.

Var a = new Array (5 );

ArrayObj = new Array ([element0], [element1],..., [elementN])

// Create an array and assign values.

Var a = new Array (["B", 2, "a", 4,]);

ArrayObj = [element0, element1,..., elementN]

// Create an array and assign values in short. Note that brackets do not indicate that they can be omitted.

Var a = ["B", 2, "a", 4,];

Note: note the difference between "[]" and "[]".

Var a = new Array (5); // creates an Array of 5 characters.

Var a = new Array ([5]); // creates an Array with a length of 1 and a first value of 5.

Array Operation (Transfer address)


Var t2 = new Array (); t2 [0] = 1; t2 [1] = 2; test2 (t2); // transfer address (Array) function test2 (var2) {for (var I = 0; I
 
  

The above is a detailed explanation of the JavaScript advanced Array (10). For more information, see PHP Chinese Network (www.php1.cn )!

Related Article

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.