Here is the code snippet:
'use strict';
var foo=function(){
alert(this);
}
var bar = {
baz:foo,
};
var x = bar.baz;
x();//1
After executing the code directly, everything works fine and it alerts undefined
. However, when I insert a breakpoint at (1) and press F11 twice, it then alerts window
.
Could someone please explain this behavior to me? Thank you.