I was asking this and it's a little bit confusing... What will be printed on the console.
var a = {
b : {
foo : function(){
console.log(this);
}
}
}
a.b.foo();//in console : foo function
var b = a.b;
b.foo();//in console : foo function
var foo = a.b.foo;
foo();////in console : window
The first one is quite obvious. Why second print is also foo function and third is window object? thanks