JavaScript · Senior · Question 49 of 75
What is globalThis useful for?
- ✓Correct answer: Uniform access to the global object in any environment
- 2It's a new name for
windowthat works only in the browser - 3It creates an isolated global scope for each module
Explanation
In the browser the global object is window, in workers self, in Node.js global. globalThis works everywhere, which matters for universal (isomorphic) code and libraries.