Creating dense arrays

A dense array allows programmers to efficiently declare an array when the initial values of the array is known beforehand. Dense arrays are supported in all major browsers. But before we officially get to dense arrays, lets review the syntax for a regular array first.

Quick review of declaring a "normal" array

By default, values are entered into an array first by declaring it, then storing the values into its elements, one by one:

var myarray=new Array(3)

The above method of entering values into an array works just fine in most situations. However, don't you wish there were a more efficient way of doing the same thing, especially when the array is quite large?