12 KiB
| title | chunk | source | category | tags | date_saved | instance |
|---|---|---|---|---|---|---|
| Global object - Glossary | MDN | 1/3 | https://developer.mozilla.org/en-US/docs/Glossary/Global_object | reference | web, html, css, javascript, documentation | 2026-05-05T05:32:35.660821+00:00 | kb-cron |
MDN HTML HTML: Markup language
HTML reference
HTML guides
Markup languages
CSS reference
CSS guides
Layout cookbook
JavaScriptJS JavaScript: Scripting language
JS reference
JS guides
Web APIs Web APIs: Programming interfaces
Web API reference
Web API guides
- Using the Web animation API
- Using the Fetch API
- Working with the History API
- Using the Web speech API
- Using web workers
Technologies
Topics
Learn Learn web development
Frontend developer course
- Getting started modules
- Core modules
- MDN Curriculum
- Check out the video course from Scrimba, our partner
Learn HTML
Learn CSS
Learn JavaScript
Tools Discover our tools
About Get to know MDN better
Global object
The global object in JavaScript is an object which represents the global scope. Note: Globally available objects , which are objects in the global scope, are sometimes also referred to as global objects, but strictly speaking, there is only one global object per environment. In each JavaScript environment, there's always a global object defined. The global object's interface depends on the execution context in which the script is running. For example:
- In a web browser, any code which the script doesn't specifically start up as a background task has a
Windowas its global object. This is the vast majority of JavaScript code on the Web. - Code running in a
Workerhas aWorkerGlobalScopeobject as its global object. - Scripts running under Node.js have an object called
globalas their global object.
The globalThis global property allows one to access the global object regardless of the current environment.
var statements and function declarations at the top level of a script create properties of the global object. On the other hand, let and const declarations never create properties of the global object.
The properties of the global object are automatically added to the global scope.
In JavaScript, the global object always holds a reference to itself:
In this article
See also
- Related glossary terms:
globalThisWindowWorkerGlobalScopeWindow.windowWindow.selfWindow.framesWorkerGlobalScope.selfglobal