JavaScript Array Method Encyclopedia

Source: Internet
Author: User

Array in the written test will often appear in the face test, JavaScript in the array and other languages of the array is somewhat different, in order to facilitate the study of the array method, the following small series for everyone to organize the operation of the array of methods, together to see.

Array Creation

There are two ways to create arrays in JavaScript, the first of which is to use the array constructor:?

1 2 3 var arr1 = new Array (); Create an empty array var arr2 = new Array (20); Create an array containing 20 items var arr3 = new Array ("Lily", "Lucy", "Tom"); Create an array that contains 3 strings

The second basic way to create an array is to use an array literal notation:?

1 2 3

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.