Variable declaration keyword
A variable declaration keyword is a programming-language keyword that introduces a variable binding.
Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond
A JavaScript keyword that declares a block-scoped local variable whose binding cannot be accessed outside the block where it is declared.
- How it is used
- Keeps changing JavaScript variables local to blocks, especially loops, instead of letting function-scoped declarations escape their intended use.
- How deep it goes
- Explains block scope, loop behavior, hoisting, and temporal-dead-zone errors through examples, stopping at observable behavior rather than engine internals.
- Examples
- Contrasts delayed loop callbacks, hides data in a free-standing block, and challenges readers to remove IIFEs from a range function.
- What you can do after
- Practice/perform block-scoped declarations in loops and replace IIFEs used only to contain local variables.
Secrets of the JavaScript Ninja, Second Edition
A JavaScript keyword used to declare a variable binding, such as var, let, or const.
- How it is used
- Distinguishes JavaScript variable declarations by mutability and relationship to the lexical environment.
- How deep it goes
- Compares three declaration keywords by two properties: mutability and relationship to the lexical environment.
- Examples
- Names var, let, and const as the three declaration keywords.
- What you can do after
- Understand the comparison of var, let, and const by mutability and lexical-environment relationship.
Read how Secrets of the JavaScript Ninja, Second Edition explains variable declaration keyword →
Related concepts
- bindingcontrasts with · Name binding is the association of an identifier with the program entity or value it denotes.
- scopeuses · Scope is the region of a program in which names are visible and can be resolved according to the language’s lookup rules.
- const qualifiercontrasts with · A language feature that marks a value, binding, or access path as constant, restricting reassignment or modification according to the language’s rules.
- hoistingcontrasts with · Hoisting is JavaScript behavior in which certain declarations are registered within their scope before execution reaches their textual position.
- immediately invoked function expressionaddresses · An immediately invoked function expression is a JavaScript function expression that is defined and executed immediately within the same syntactic construct, often creating an isolated scope.
- lexical environmentconfigures · A structure that associates identifiers with bindings and provides the context for resolving names at a point in program execution.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

