CARD 1
Introduction
Login to report note issues for this section.
Hoisting
Hoisting is JavaScript's default behaviour of moving declarations to the top of their scope before any code is executed. It is not a physical movement of code — JavaScript's engine processes declarations first during a compilation phase before running the code line by line.
The result is that certain variables and functions can be referenced before the line where they are written.
codejs
Understanding hoisting explains many confusing JavaScript behaviours and is essential for understanding why let, const, and function expressions behave differently from var and function declarations.