What Hoisting Means
Declarations are conceptually moved to the top of their scope during compilation, but initializations are not. This means you can use variables and functions before they're declared in the code, but the behavior differs based on the declaration type.
Function declarations are hoisted with their body; `var` declarations are hoisted but initialized to `undefined`. This creates different behaviors that developers need to understand to avoid bugs.
Hoisting is a JavaScript mechanism where variables and function declarations are moved to the top of their containing scope during the compilation phase. This allows functions to be called before they're defined and variables to be referenced before their declaration.
The hoisting process happens during the creation phase of execution context. All declarations are processed before any code execution begins, which is why hoisting appears to 'move' declarations to the top.