JavaScript · Senior · Question 49 of 75

What is globalThis useful for?

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.

Further reading

Problem with a question

JavaScript · Senior · question 49

Test yourself

Take the JavaScript · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz