В первой же ссылке в гугле:
https://stackoverflow.com/questions/60346825/why-d...
With map, it is possible to say: "As you step through the array, if you encounter an index that has no property, leave that property similarly unset in the output array." For all existing properties, output indices will still correspond to their input indices, and the missing properties are skipped in both the input and output.
Array.prototype.map
Repeat, while k < len
Let Pk be ! ToString(k).
Let kPresent be ? HasProperty(O, Pk).
If kPresent is true, then
Let kValue be ? Get(O, Pk).
Let mappedValue be ? Call(callbackfn, T, « kValue, k, O »).
Perform ? CreateDataPropertyOrThrow(A, Pk, mappedValue).
Increase k by 1.
Т.е.
map()
пропускает пустые, не инициализированные значения в массиве. Так что просто используйте метод
fill().