> For the complete documentation index, see [llms.txt](https://bharat-tiwari.gitbook.io/our-tech-journal/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bharat-tiwari.gitbook.io/our-tech-journal/javascript/execution-context.md).

# Execution Context

In Javascript, whenever a code starts running/execution, an **Execution Context** is created. Its that logical box inside which the code executes.&#x20;

At the very first, Global Execution Context is created, in which the globally declared variables and functions are placed and global code is executed.&#x20;

(In javascript, any code that is not inside a function is global.)

Once any function is called in the global code, an inner Execution context is created for the called function&#x20;

When the base Global Execution Context is created, the Javascript engine automatically creates three things for us:

* **Global** object (in case of Browsers, the **window** object points to this Global object)
* **'this'** variable  - in Global context, 'this' points to the Global object and thus to window object
* a link to outer environment (in case of Global execution context, the outer environment would be null or undefined as Global context is the outermost context one can get to)

![](https://1265790178-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0HLhUbeW2DVd3onhHh%2F-M2U_HbwOIqsMsIu6Olm%2F-M2WUQ4GevSs5mV0jUI2%2F1.png?alt=media\&token=314eb167-043a-4436-bb75-d12a6fd04b38)
