Context and Environment

Execution Context and Lexical Environment

Execution Context:

  • When java script engine sees the brackets, creates its own execution context inside the call stack, after the execution it will popes out the call stack.

  • Any time running the java scrip code, it will be a part of execution context.

Global Execution context:

  • when ever we run the java script code, it creates a Global execution context that gives global object 'window' and 'this' and this === window.

  • After the global execution context is created, functional execution context will be created.

Lexical Environment:

  • Lexical is compile time.

  • Makes to know where the code is written.

  • Every function creates a new lexical environment.

  • Execution context says which lexical environment is currently running.

Lexical scope: (definition)

Lexical scope (available data + variables, where the function was defined) determines the available variables.

Dynamic scope: (execution)

Where the function is called.

Last updated