7.Array Array Object

Source: Internet
Author: User
Tags array definition

An array object is a collection of objects that can be of different types. Each member object of an array has a "subscript" that represents its position in the array, which is zero-based

Method of array Definition:

1. Defines an empty array:

var array name = new Array ();

2. Define an array of n empty elements when specified:

var array name =new array (n);

3. When defining an array, initialize the data directly:

var array name = [< element 1>, < element 2>, < element 3>...];

We define the MyArray array and assign the values to the code as follows:


Description: defines an array myArray, inside the element is: myarray[0] = 2; MYARRAY[1] = 8; MYARRAY[2] = 6.

Array elements are used:

Array name [subscript] = value;

Note : The subscript of the array is enclosed in square brackets, starting with 0.

Array properties:

Length usage:< Array Object >.length; return: The length of the array, which is the number of elements in the array. It equals the subscript of the last element in the array plus one.

Array method:

The above methods do not explain all, only part of the method. This section has no tasks, quickly go to the next section to learn.

7.Array Array Object

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.