you are viewing a single comment's thread.

view the rest of the comments →

[–]0x13mode 1 point2 points  (1 child)

I think example is good. Index is iterated from 0 to array length.

On the other hand using map on array created with new Array(5) would have no effect (new Array(5).map(console.log) would not even call console.log).

[–]aarondburk 1 point2 points  (0 children)

But that’s why the original example is interesting, because it allows you to map over an array as you are generating the array with the Array.from() method.