Files
scriptc/tests/corpus/2707-array-search-huge-sparse.ts
Chris Tate 94fd361b54 Implement sparse native arrays and missing-value parity (#297)
Represent ordinary JavaScript arrays with hole, value, and explicit-undefined states; add sparse side storage and carry missing values through the frontend, native backends, runtime, and Node-facing consumers.
2026-09-12 22:39:07 -05:00

12 lines
398 B
TypeScript

// Searches must jump over a billion-index hole run instead of visiting every
// absent position. The completion itself is the regression signal.
const high = 1_000_000_000;
const sparse: number[] = [];
sparse[high] = 7;
console.log(sparse.length);
console.log(sparse.indexOf(sparse[high]), sparse.includes(sparse[high]));
const missing = sparse[high - 1];
console.log(sparse.includes(missing));