DEV Community

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

sreisner profile image
Shawn Reisner Author • Edited on

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.