Consider the following function:
function foo() {
console.log("bar");
console.log(this);
}
foo(); // calling the function
It is worth noting that we are executing this in standard mode, rather than strict mode.
The value of this would be reported as window when executing in a browser.
This is due to the fact that window is the global variable in the scope of a web browser.
If you ran this identical piece of code in a node.js environment, it would refer to the global variable in your app.