Answer
Scope determines where a binding can be resolved by name.
• ECMAScript uses lexical environments to record bindings and outer-environment links.
• Functions, modules, scripts, and blocks can establish scopes.
• Identifier lookup follows the chain of outer lexical environments.
Example
Code
const outer = 'outside';
{
const inner = 'inside';
console.log(outer, inner);
}Output
outside inside
Quick Revision
Scope controls where bindings are visible.