The this value in the console will be the same as the this value in the current executable code. Consider: -
function outer() { // this is window var x = {n:12}; var fn = function() { // this is object {n:12} alert(this.n); } fn.call(x); }
...
<img src="thing.gif" onclick="outer()" />
If you put a breakpoint on the line x = {n:12} , switch to the console, you will see that this is a window. However, when you go to the alert this line, the console contains an object held by the variable x . IOW there is no difference between this in the executable context and the console. For this reason, you can use the console to adjust the values โโof variables and properties during debugging.
AnthonyWJones
source share