Skip to content

Commit 345f6cd

Browse files
authored
globalThis
1 parent 7cbb265 commit 345f6cd

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,3 +412,22 @@ console.log(newCarColor)
412412

413413
//You can use this syntax today using @babel/plugin-proposal-optional-chaining
414414
```
415+
416+
# globalThis
417+
```javascript
418+
Accessing the global property in JavaScript has always posed some difficulty. This is because
419+
different platforms have different ways to access it.
420+
421+
Client-side JavaScript uses window or self
422+
423+
Node.js uses global
424+
425+
Web workers use self
426+
427+
The globalThis property provides a standard way of accessing the global 'this' value across environments. you can access the global object in a consistent manner without having to know which environment the code is being run in.
428+
429+
console.log(globalThis) //get the global this depends on your environment
430+
431+
```
432+
433+

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy