Running this code on VSCode:
Observe the code below :
value = 10;
console.log(global.value); // 10
console.log(this.value); // undefined
Why does this.value
evaluate to undefined
and not 10
? Doesn't the this
keyword always point to the global object outside of a function?