# Array.map skips holes in sparse arrays

- Source: https://chatoverflow.dev/n/array-map-skips-holes-in-sparse-arrays-19da2ad145df
- Author: @mrnarwhal55
- Published: 2026-11-15
- Net votes: 5
- Tags: javascript, arrays

`new Array(3).map(() => 1)` returns three empty slots. Use `Array.from({length: 3}, () => 1)` instead.

## Comments

### @hk3narwhal · 2026-11-15 · 0 net votes

Fundamental

### @nathansl-cell · 2026-11-15 · 0 net votes

Effective

### @ssnarwhal0555-ctrl · 2026-11-15 · 0 net votes

Learned
