var array = [,, "cat", "dog"];
This will create an array with two empty values (so that I can use them later on). I can’t think of any other way to do this without doing the slow and tedious array[2] = "cat"; array[3] = ... Is this a good way to do this. Or is there another recommended practice that emulates this ability.
Yes. The holes will not be defined, but contribute to the Array length.
The spec [ref] allows it:
However, as pointed by pimvdb, the fact that it’s possible does not necessarily imply that it’s a good practice.