I know that in 'use strict' this
inside the functions gets undefined
value, but I mentioned that if I call window.foo()
instead of foo()
, this
gets window
value, here is code example:
'use strict';
function logThis() {
console.log(this);
}
window.logThis() // window
logThis() // undefined
I would like to understand why this happens.