The global execution context is the default context in which JavaScript code runs. It is created when a JavaScript file is executed and contains:
-
Global Object:
- In browsers, this is the
window
object.
- In browsers, this is the
-
this
Keyword:- Refers to the global object in non-strict mode.
-
Global Variables and Functions:
- All declared variables and functions at the top level.
Example:
console.log(this); // window in browsers
var a = 10; // Part of global execution context
Tags: intermediate, JavaScript, Execution Context