I don't understand var a = [], i
here. How can a
be declared as both an array and whatever i's type is?
// Source: Javascript: The Good Parts, p. 63
Array.dim = function (dimension, initial) {
var a = [], i;
for(i = 0; i< dimension; i +=1)
{
a[i] = initial;
}
return a;
}
it means declare both (separately) - not declare them to be equal
same thing as:
var a = [];
var i;