Standard built-ins
Array.of()
Creates an array containing the supplied arguments. A single numeric argument is an element, unlike the length form of the Array constructor.
Formal Syntax & Structure
javascript syntaxjavascript
Array.of(...items)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| items | any[] | Values placed at consecutive indices. |
Return Value
Array
New array when called as Array.of.
Working Example
Example Snippetjavascript
console.log(Array.of(6).length,Array.of(6)[0]);