mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-21 19:16:23 +00:00
519 B
519 B
date | id | title |
---|---|---|
2020-11-13 | 5ec66270-20b0-466e-85ea-dd7472a84880 | Array.from() |
Syntax
const arr2 = Array.from(arguments);
If a value is iterable (as all Array-like DOM data structure are by now), you can also use the spread operator (…) to convert it to an Array:
const arr1 = [...'abc'];
// ['a', 'b', 'c']
const arr2 = [...new Set().add('a').add('b')];
// ['a', 'b']