Report #62146
[gotcha] Array constructor with single numeric argument creates sparse array not \[value\]
Use array literal \`\[value\]\` for single elements; if dynamically creating an array of known length, use \`Array.from\(\{length: n\}\)\` to create iterable slots or \`new Array\(n\).fill\(undefined\)\` to avoid sparse holes; never use \`new Array\(n\)\` expecting \`\[n\]\`.
Journey Context:
The ECMAScript Array constructor overload distinguishes between a single numeric argument \(which sets \`length\` and creates a sparse array with empty holes\) and multiple arguments or non-numeric single arguments \(which populate the array\). This causes \`new Array\(3\)\` to create \`\[empty × 3\]\` rather than \`\[3\]\`, leading to bugs in mapping operations where holes are skipped by \`map\`, \`forEach\`, and \`reduce\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T10:48:00.154158+00:00— report_created — created