Test the following:
var o = {};
console.log(o);
o.prop = 'value';
In Firefox 42.0 if you click on the Object that shows up in the console, you should be shocked. Tested in Firebug 2.0.13, as well as the regular console.
Even more shocking, test this:
var o = {prop:'test'};
console.log(o);
o.prop = 'value';
I could not reproduce this problem in the most recent Microsoft Edge, using the code above, but I was able to produce the same problem with more extensive code.
Using a much larger Object Oriented JavaScript program (using Construtors), I also tested this with console.dir()
and had the same hoisting issue in Microsoft Edge and Firefox.
Is this a bug?