Javascript Array object, javascriptarray

Source: Internet
Author: User

Javascript Array object, javascriptarray

Array objects are used to store multiple values in a single variable.

Syntax:

<Span style = "font-size: 14px;"> new Array (); new Array (size); new Array (element0, element1 ,..., elementn); </span>

ParametersSizeIs the expected number of array elements. Returned array. The length field is setSize.

ParametersElement...,ElementnYesparameter list. When these parameters are used to call the constructor Array (), the elements of the newly created Array are initialized to these values. Its length field is also set to the number of parameters.

 

Return Value description:

The function returns the newly created and initialized array.

If no parameter is used when the constructor Array () is called, the returned Array is empty and the length field is 0.

When a constructor is called, only one numeric parameter is passed. The constructor returns an array with a specified number and an undefined element.

When other parameters call Array (), the constructor initializes the Array with the value specified by the parameter.

When a constructor is called as a function without the new operator, its behavior is exactly the same as that when the new operator is used to call it.

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.