DEV Community

loading...

Discussion on: Here's Why Mapping a Constructed Array in JavaScript Doesn't Work

Collapse
sreisner profile image
Shawn Reisner Author • Edited

Great question. The reason we can spread an array with no index keys is because spread's implementation doesn't require that any index keys exist, unlike map. It blindly loops from 0 to 99, asks the array for array[index], and places whatever's returned in the new array.

Forem Open with the Forem app