Hi there,
I was trying different types of array initialisation in Javascript and the book that I was reading, said it is possible to initilaise an array with a speicified number of elements in it. However, I tried it and unfortunately, it didn't work. As you can see the code below, the array b should ONLY have 3 empty elements in it. But, that can add more than 3 elements into it.
var b = new Array(3);
//assigning values to the indexes of array b
for(var i=1; i <= 6; i++){
b[i]= i;
alert(b.length);
println(b[i] + ", ");
}