Possible Duplicate:
What is “undefined x 1” in JavaScript?
In Chrome 21, feeding [,] to the console outputs
[undefined x 1]
and feeding [undefined] outputs
[undefined]
What is the difference between [undefined] and [undefined x 1]?
What is the notation [undefined x 1]?
[,]is a sparse array. It has a length of1, but no values (0 in [,] === false). It can also be written asnew Array(1).[undefined]is an array of length1with the valueundefinedat index0.When accessing the property “
0“, both will returnundefined– the first because that property is not defined, the second because the value is “undefined”. However, the arrays are different, and so is their output in the console.