Array.prototype.keysintermediateconst sparse = [1, , , 4]
[...sparse.keys()] // β [0, 1, 2, 3] (includes holes)keys() yields indices for every slot including holes in sparse arrays.
Unlike forEach or map, keys() iterates over every index, including holes in sparse arrays. new Array(n) creates a sparse array with n holes β keys() still yields 0 through n-1.
Challenge: Implement sparseKeys(n) that returns all indices of a sparse array of length n.
sparseKeys(3) // β [0, 1, 2]
sparseKeys(0) // β []