DEV Community

Cover image for What is globalThis? ES2020 new features
twostepdeveloper
twostepdeveloper

Posted on

1 1

What is globalThis? ES2020 new features

A new property added in es2020 called globalThis. It's cross-platform support to access to the global object in JavaScript. Accessing the global property in JavaScript has always posed some difficulty. This is because different platforms have different ways to access it.

such as :
Client side uses: windows,frames,this
web workers uses: self
node js uses: global

now all environment can use simple globalThis .
Also you can watch my video on this topic.
https://youtu.be/yn3J6KfMqBw

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more