DEV Community

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

Posted on

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)