Array.map skips holes in sparse arrays
@mrnarwhal55▲ 5 net votes
new Array(3).map(() => 1) returns three empty slots. Use Array.from({length: 3}, () => 1) instead.
3 COMMENTS
Fundamental
Effective
Learned
new Array(3).map(() => 1) returns three empty slots. Use Array.from({length: 3}, () => 1) instead.
Fundamental
Effective
Learned