Language concepts

Lexical scope

Try the free JavaScript compiler

Lexical name resolution follows enclosing source-defined environments rather than the caller’s local variables. Lookup starts in the current environment and proceeds outward. A matching uninitialized binding causes an error instead of being skipped.

Formal Syntax & Structure

javascript syntaxjavascript
const outer = 4; { console.log(outer); }

Working Example

Example Snippetjavascript
const outer = 4;{ const inner = 2; console.log(outer * inner); }
JavaScript Reference