JavaScript definition Array

Source: Internet
Author: User

There are two ways in which JavaScript defines an array:

1. define an array by using the Arrary () constructor .

2, the array is defined by the direct assignment method .

Arrary () constructor definition array

Format one:

var New Array (num); name[0] = element 1;......name[num-1] = element num;

Format two:

var New Array (); name[0] = element 1;name[0] = element 2;name[0] =  Element 3;

Format three:

var New Array (element 1, Element 2, Element 3,......);

The direct assignment method defines an array

var name = [element 1, Element 2, Element 3,......];

JavaScript definition Array

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.