DEV Community

Discussion on: πŸ›‘Stop using `this` instead use `globalThis` for global variables

Collapse
 
adam_cyclones profile image
Adam Crockett πŸŒ€

I thought globalThis has more to do with context of environment. The title of this post is a bit misleading in a way.. kind of, this bleeding out to a global scope is an unfortunate accident in my book rather than explicit intention using window or module or global etc. Maybe stop using this to target the global scope.

Collapse
 
lampewebdev profile image
Michael "lampe" Lazarski

Hmm this is why I added the "for global variables".

I thought this would be enough?

What would be a better title?

Collapse
 
adam_cyclones profile image
Adam Crockett πŸŒ€ • Edited

'Stop using global variables and if you have to, think about if your code is isomorphic, then if it is use globalThis'. It's a bit wordy. Sorry I think your title is better.

Thread Thread
 
lampewebdev profile image
Michael "lampe" Lazarski

haha, that's the problem with title :D
Coming up with a good title is an art.
And I'm bad at it :D