DEV Community

Discussion on: 🛑Stop using `this` instead use `globalThis` for global variables

Collapse
 
moopet profile image
Ben Sinclair

They've chosen a poor name there, I think. 'global' implies it's the top level, this implies it's local to whatever context you're in. Everyone should be able to access "global" scope, but other modules shouldn't see your this.

So how is globalThis a name that's going to work? It's another way Javascript is getting more confusing. Wouldn't it be better to suggest not sharing global scope at all?

Collapse
 
lampewebdev profile image
Michael "lampe" Lazarski

You can read more about it here: github.com/tc39/proposal-global/is...