Scope
Scope — Scope determines the accessibility of variables, functions, and objects in a particular part of your code during runtime. JavaScript has function scope (var) and block scope (let, const). Global scope is accessible everywhere. Each function creates its own scope. Lexical scoping means inner functions can access outer variables. Scope chains allow nested functions to access variables from parent scopes. Understanding scope is crucial for avoiding bugs and writing maintainable code. This term relates to the Function category of the reference. You will meet scope in practice when working with APIs such as Function.prototype.call(), Function.prototype.apply(), Function.prototype.bind(), Function.prototype.toString(). Related terms: Closure, Hoisting, Event Loop, Prototype Chain, Temporal Dead Zone (TDZ), IIFE (Immediately Invoked Function Expression). Understanding scope makes the rest of the JavaScript documentation noticeably easier to follow, because the concept recurs across methods, guides, and error messages. Look up more definitions in the JavaScript glossary.