Array object (i)

Source: Internet
Author: User

An array is a pre-defined object (also known as a Class) in JavaScript that can be used directly.

Create array object: var array = new Array ();

Creates an array object with the specified number of elements: var array = new Array (20);

Creates an array object with the specified element: var array = new Array (' Zhang San ', ' John Doe ', ' Harry ', ' Zhao Liu ');

An Array object declaration is another way of not using the new keyword, but rather using [] to include the value of the element directly, as with the effect of using the New keyword

Output the values of all the elements in the array object, remember for...in?

Attention:

Regardless of whether or not the array object is defined in advance, you can add elements to it, which is a bit of a synthesis of arrays and ArrayList in C # (Why do you say that)?
If the element is not added in indexed order, the intermediate element is populated with undefined

Array object (i)

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.