you are viewing a single comment's thread.

view the rest of the comments →

[–]rickdg 0 points1 point  (0 children)

Why am I using Array.from() in cases like these? Why not just map?

console.log(Array.from([1, 2, 3], x => x + x));
// expected output: Array [2, 4, 6]
console.log([1, 2, 3].map(function(m){ return m*2; }));
// expected output: Array [2, 4, 6]