JavaScript Array Performance: Initialize to Optimize
The JavaScript interpreters in the most popular browsers distinguish between sparse and dense arrays. Hence, you may get more “array-like” performance if you initialize an array before using it. But this trades memory for speed, so it may not always be the best choice.