A
Antti Nummiaho
Consider the following javascript:
var temp = new Array(new Array(0))
document.writeln(temp[0][0])
temp = new Array(new Array(0,1))
document.writeln(temp[0][0])
One would assume that it would print "0 0" that is the first elements
of the arrays, but it prints "undefined 0". Why does temp[0][0] return
undefined when there is only one element in the array but returns the
first element correctly when there are at least two elements?
var temp = new Array(new Array(0))
document.writeln(temp[0][0])
temp = new Array(new Array(0,1))
document.writeln(temp[0][0])
One would assume that it would print "0 0" that is the first elements
of the arrays, but it prints "undefined 0". Why does temp[0][0] return
undefined when there is only one element in the array but returns the
first element correctly when there are at least two elements?