What is the value of this returned from an arrow function on an object literal when running in nodejs. This question was asked here however the answer is just not correct in nodejs. It is not global and it is not undefined in strict mode.
Here is the code snippet that I'm running:
"use strict"; // <-- Has no affect.
let a = {
f: () => this
};
console.log(a.f()) // {}
console.log(a.f() === global); // false
console.log(a.f() === {}); // false
console.log(a.f() === Object.create(null)); // false
Update:
Another way to illustrate what I'm seeing, run this at your command prompt:
node -e "let a = { f: () => this }; console.log( a.f() === global);" // returns true
Now, copy the contents of the code in the string above into a script.js and run via:
node script.js // returns false