Array()
syntax: |
new Array(length) new Array([element1, ...]) |
where: |
length - If this is a number, then it is the length of the array to be created. Otherwise, it is the element of a single-element array to be created.
elementN - list of elements to be in the new Array object being created.
|
return: |
object - an Array object of the length specified or an Array object with the elements specified.
|
description: |
The array returned from this function is an empty array whose length is equal to the length parameter. If length is not a number, then the length of the new array is set to 1, and the first element is set to the length parameter. Note that this can also be called as a function, without the new operator.
The alternate form of the Array constructor initializes the elements of the new array with the arguments passed to the function. The arguments are inserted in order into the array, starting with element 0. The length of the new array is set to the total number of arguments. If no arguments are supplied, then an empty array of length 0 is created.
|
see: |
|
example: |
var a = new Array(5); var a = new Array(1,"two",three); |