Array.from() method returns a new array from any array-like or iterable object.
syntax ↴
Array.from(arrayLike, mapFn, thisArg) ↴
arrayLike An iterable or array-like object to convert to an array.
mapFn (optional). Function to call on every element of the array.
thisArg (optional). Value to use as this when executing mapFn.
array-like object is any object that has a length property and has indexed elements.
iterable object can be an object such as Map or Set; or, if the object is not iterable,
To convert an ordinary object that's not iterable or array-like to an array (by enumerating its property keys, values, or both), use Object.keys(), Object.values(), or Object.entries().
Array.from() method never creates a sparse array. If the arrayLike object is missing some index properties, they become undefined in the new array.
Array.from(arrayLike)
Array.from(arrayLike, mapFn)