A function execution context is created when a function is invoked. It contains:
-
this
Binding:- Depends on how the function is called.
-
Scope Chain:
- Includes variables from the function's scope and its outer lexical environments.
-
Variable Environment:
- Stores function variables and parameters.
Example:
function example() {
var a = 10; // Stored in variable environment
console.log(this); // Depends on invocation
}
example();
Tags: intermediate, JavaScript, Execution Context