Consider the following example:
const f1 = () => this;
function f2() {
return this;
}
console.log(f1(), f2());
When this code is executed in a browser, the result is as follows:
> window window
But when this code is executed in Node.js, the result is not quite as expected:
> {} global
Why in Node.js the empty object was taken as the context of an arrow function instead of Global Object (global
on this platform)?