Axion's example does that. JavaScript arrays are always dynamic. The code handles the array's dimensions for you, you never have to worry about it.
Code:
var myArray = new Array();  //currently the array is completely empty, it will return no elements, but will support push() and such
myArray[0] = "foo";  //The array now has a length of 1, and the value of the first element is a string
myArray.push("bar");  //The array now has a length of 2
myArray[99] = "blah";  //The array now has a length of 100
//but only the first two and the last one elements have values assigned
//the rest are still empty