Array Function

Top  Previous  Next

Creates an array.



Array([element0 [, element1 [, ...]]])


length The number of elements in the array.
elementn The initial values of the array elements.

Return Value

An Array object. In the first case, the array has the number of elements specified by length, which are initialized to undefined. In the second case, the array has a number of elements equal to the number of arguments given, and the elements are initialized to the values of the corresponding arguments.


When Array is called with a single argument, it is considered the first form (array length) if the argument is type Number. Otherwise, it is considered the second form (a one-element array).