Array.from
from — Creates a new array from an array like input.
Description
Array.from(mixed array, [function callback, [object this]])
Parameters
Name | Description | Type | Default | Optional |
---|---|---|---|---|
array | See array below. | mixed | No | |
callback | See callback below | function | Yes | |
this | object | Yes |
array
An array, or array like input. Something that has a length and indexed items.
callback
The following parameters is passed to the callback.
- value
The value of the current index.
- index
The current index.
Return values
array
Changelog
Version | Description |
---|---|
ES 6 | Introduced. |
Examples
Example #1 – from example