JavaScript Tutorial

Sparse Arrays

Arrays where indices are not contiguous or have undefined elements.

const arr = [];
arr[0] = 1;
arr[10] = 2;
console.log(arr.length); // 11 (sparse array)