Concept Flow - Common hoisting pitfalls
Start Execution
Parse Declarations
Hoist var declarations
Execute code line by line
Encounter var usage before assignment?
Value is undefined
Encounter let/const usage before declaration?
ReferenceError thrown
End Execution
JavaScript first moves variable declarations (var) to the top but not their assignments, causing undefined values if used early; let and const cause errors if used before declaration.