- Tutorials
- JavaScript Tutorial
- JavaScript Scope & Hoisting
JavaScript Scope & Hoisting
6 lessonsAbout 36 minutesBeginner
This part of the JavaScript Tutorial runs from JavaScript Scope through to JavaScript this Keyword. There are 6 lessons here, and working through them takes about 36 minutes at a steady pace.
It follows on from JavaScript Functions, so finish that first if you have not already — the examples below assume you are comfortable with it.
Each lesson below says what it covers before you open it. Read them in order the first time; afterwards this page works as a index you can jump back into when you need to check one thing.
- 1JavaScript ScopeJavaScript scope decides where in your code a variable can be seen and used.
- 2JavaScript Block ScopeJavaScript block scope means let and const variables only exist inside the braces where they were declared.
- 3JavaScript HoistingJavaScript hoisting moves declarations to the top of their scope before the code runs.
- 4JavaScript Temporal Dead ZoneThe JavaScript temporal dead zone is the gap between entering a scope and reaching a let or const declaration.
- 5JavaScript ClosuresA JavaScript closure is a function that remembers the variables around it, even after the outer function has finished.
- 6JavaScript this KeywordThe JavaScript this keyword refers to the object that is running the current function.
