A global object is an object that always exists in the global scope.
In JavaScript, there's always a global object defined. In a web browser, when scripts create global variables, they're created as members of the global object (In Node.js this is not the case). 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.
Document Tags and Contributors
    
    Tags: 
    
  
                    
                       Contributors to this page: 
        chriszhq, 
        Sheppy, 
        pencilsmcfour, 
        Jeremie, 
        Andrew_Pfeiffer, 
        klez, 
        kscarfone, 
        panaggio
                    
                    
                       Last updated by:
                      chriszhq,