Possible Duplicate:
Bizarre console.log behaviour in Chrome Developer Tools
Given the following script :
var Test = function () {
console.log("constructor");
this.positions = [];
console.log(this.positions);
console.log("constructorEnd");
this.addPosition = function () {
console.log(this.positions);
var i = this.positions.length;
this.positions[i] = "aa";
console.log(this.positions);
}
}
var t = new Test();
console.log("constructed");
t.addPosition();
}
The expected result is :
constructor
[]
constructorEnd
constructed
[]
["aa"]
This is what I can see using firebug. The very same script on chrome (linux, 16.0.912.21 dev) gives me :
constructor
["aa"]
constructorEnd
constructed
["aa"]
["aa"]
What does that mean ?? Adding a breakpoint in chrome to see what happen make it works (same ouput as firefox) ! Here is a testcase : http://jsfiddle.net/sNzKq/1/
thanks