I am getting inconsistent results across browsers with this code:
var A = [];
var B = [{}];
console.log(A);
console.log(B);
for(var i = 0;i<5;i++){
A[i] = "A";
B[i] = "B";
};
Chrome (reload page with console open):
[]
[Object]
0: "B"
1: "B"
2: "B"
3: "B"
4: "B"
length: 5
__proto__: Array[0]
Firefox:
Array [ "A", "A", "A", "A", "A" ]
Array [ "B", "B", "B", "B", "B" ]
IE 11:
[] - length 0
[object Object] - length 1
The expected behavior is IE one. Can anyone shed some light?