Built-in objects
Array constructor
Creates an array. A single Number argument denotes the array length and must be a valid length; multiple arguments become elements. Prefer literal syntax for a single numeric element.
Formal Syntax & Structure
javascript syntaxjavascript
Array(...items) or new Array(...items)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| items | values or single length | Elements, or one numeric length. |
Return Value
Array
New array.
Working Example
Example Snippetjavascript
console.log(Array(3).length, 0 in Array(3), [3][0]);