Global root object don't known about context (this.bar is undefined)
silentiumNoxe opened this issue · comments
https://gist.github.com/silentiumNoxe/aefea0cbd938432dfc1815fe800b30f0
I've found an interesting case with "this" pointer. Gist above shows my tests with the root object.
Example from gist:
const bar = function() { return "hello"}
bar() // hello
this.bar // undefined
Seems like that is working the same as in the browser. E.g. on chrome I get
> const bar = 123
undefined
> bar
123
> this.bar
undefined
which is exactly what you are seeing. It looks like global variables in JS don't work the way you think they do, but that isn't a v8go issue.
oh yes, i'm sorry