When I create a new JavaScript array, and use an integer as a key, each element of that array up to the integer is created as undefined.
For example:
v
Use an object - with an integer as the key - rather than an array.