Array.of

of — Creates an array.

Description

Array.of([mixed params, …])

Parameters

Name Description Type Default Optional
params, … mixed Yes

Return values

array

Changelog

Version Description
ES 6 Introduced.

Examples

Example #1 – of example
var array = Array.of(1, 2, 3); console.log(array); // [1, 2, 3]
Example #2 – of example
var array = Array.of(10); console.log(array); // [10] console.log(array.length); // 1

External references