The following code works properly in Firefox but not in Chrome? If you comment out line 15 to prevent the error on line 7 (cannot find this.update()), the code continues to execute properly. I cannot see why the first set of definitions is different to the first.
if (typeof RegionUpdater == "undefined") {
function RegionUpdater(param1, param2, param3) {
this.paramA = param1;
this.paramB = param2;
this.paramC = param3;
this.update();
}
RegionUpdater.prototype.update = function() {
alert("hi there");
};
}
var ru = new RegionUpdater("1", 2, "3");
function LolUpdater(param1, param2, param3) {
this.paramA = param1;
this.paramB = param2;
this.paramC = param3;
this.update();
}
LolUpdater.prototype.update = function() {
alert("hi there");
};
var lu = new LolUpdater(1, 2, 3);
I've got a jsfiddle setup here: http://jsfiddle.net/XhbZ8/2/
EDIT: The only idea I've been able to come up with is that Chrome has some sort of speculative execution going on, but the fact that I also get the same problem in IE8 makes me less inclined to believe that's the case.