Array Function

Top  Previous  Next

Creates an array.

Syntax

Array(length)

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

Arguments

lengthThe number of elements in the array.
elementnThe 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.

Remarks

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).