By Hemanta Sundaray on 2021-06-02
Array.from() lets you create arrays from:
Array.from() has an optional parameter mapFn, which allows you to execute a map() function on each element of the array being created.
It returns a new Array instance.
console.log(Array.from("Hemanta"))
// output
[
'H', 'e', 'm','a', 'n', 't', 'a'
]
console.log(Array.from([10, 20, 30], num => num * 10))
// output
[ 100, 200, 300 ]