Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit345f6cd

Browse files
authored
globalThis
1 parent7cbb265 commit345f6cd

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 theglobal propertyin JavaScript has always posed somedifficulty.This is because
419+
different platforms have different ways to access it.
420+
421+
Client-side JavaScript useswindow orself
422+
423+
Node.js usesglobal
424+
425+
Web workers useself
426+
427+
TheglobalThis property provides a standard wayof accessing theglobal'this' value acrossenvironments.you can access theglobal objectin a consistent manner without having to know which environment the code is being runin.
428+
429+
console.log(globalThis)//get the global this depends on your environment
430+
431+
```
432+
433+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp