0/8 done~61 min
1
Mental model: Hoisting
Mental
~5 min
2
The 9 hoisting exceptions
Exceptions
~13 min
3
Predict the output
Predict
~10 min
4
True or false?
T/F
~4 min
5
Fill in the blanks
Fill
~3 min
6
Fix the bugs
Fix Bug
~7 min
7
Spot the bug
Spot Bug
~4 min
8
Put it together
Cement
~15 min
1 / 8Read~5 min
Mental model: Hoisting
Build the right picture in your head before we practice.
JavaScript hoists declarations to the top of their scope β but only the declaration, never the initialisation. var gets undefined; let/const get a Temporal Dead Zone error; function declarations hoist fully with their body.
Think of the engine as doing two passes: first it registers all declarations (hoisting), then it executes line by line. var is registered as undefined. let/const are locked until their declaration line β accessing them before that throws ReferenceError. Function declarations are registered with their full body, so you can call them before they appear in source.
Scroll to the bottom to continue
Notes
π
Loadingβ¦
Sections
0/8 done~61 min
1
Mental model: Hoisting
Mental
~5 min
2
The 9 hoisting exceptions
Exceptions
~13 min
3
Predict the output
Predict
~10 min
4
True or false?
T/F
~4 min
5
Fill in the blanks
Fill
~3 min
6
Fix the bugs
Fix Bug
~7 min
7
Spot the bug
Spot Bug
~4 min
8
Put it together
Cement
~15 min
Notes
Notes
π
Loadingβ¦