An execution context is the environment in which JavaScript code is evaluated and executed, containing the variable environment, lexical environment, and this binding.
Every time JavaScript runs code, it does so inside an execution context. There are two main types: the Global Execution Context (created once when the script starts) and Function Execution Contexts (created each time a function is called).
Each execution context goes through two phases. The creation phase scans for declarations, hoists variables (var as undefined, functions as their full definition), binds parameters, and determines the value of this. The execution phase runs code line by line, assigning values and evaluating expressions.
Execution contexts are managed on a call stack (the Execution Context Stack). The global context sits at the bottom. Each function call pushes a new context; when the function returns, its context is popped. Only the topmost context is actively running at any moment.
Interview framing: define Execution Context in one sentence, then explain one concrete runtime behavior and one common pitfall with a short code example.