DEV Community

Discussion on: 13 useful JavaScript array tips and tricks you should know

Collapse
 
froxx93 profile image
Froxx93

I didn't know about the second parameter of Array.from() as well, but I don't actually see a reason to use it instead of Array.map() in any situation.

Collapse
 
michaeljsalo profile image
Michael J Salo

MDN says, "Array.from(obj, mapFn, thisArg) has the same result as Array.from(obj).map(mapFn, thisArg), except that it does not create an intermediate array." This suggests it might perform a little better, in extreme cases.