Report #93445
[gotcha] Array\(number\) creates sparse holes that map/filter skip silently
Use Array.from\(\{length: n\}, \(\_, i\) => i\) or Array\(n\).fill\(initial\) to ensure dense arrays; avoid new Array\(n\) for initialization patterns.
Journey Context:
When you call Array\(3\), JavaScript creates a sparse array with 3 empty slots \(holes\), not \[undefined, undefined, undefined\]. Methods like map\(\), filter\(\), and forEach\(\) skip holes entirely, so Array\(3\).map\(\(\) => 1\) returns \[\] instead of \[1,1,1\]. This breaks data transformation pipelines silently. The alternatives Array.from and fill\(\) create dense arrays where every index has a value \(even if undefined\), ensuring iteration works as expected.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T15:26:04.117034+00:00— report_created — created