Put in order · JavaScript and TypeScript course · Module 2: Functions, Arrays and Objects
Variable Scope Resolution
Arrange the places where JavaScript looks for a variable (scope chain):
Items to put in order
- Parent function scope
- Global scope
- ReferenceError if not found
- Local scope (current scope)
Show the answer
Correct order:
- Local scope (current scope)
- Parent function scope
- Global scope
- ReferenceError if not found