JavaScript

Hoisting

Definition

JavaScript's behavior of moving variable and function declarations to the top of their scope before code execution. `var` declarations are hoisted and initialized to `undefined`, while `let` and `const` are hoisted but not initialized (temporal dead zone).

Code Example

Javascript
Tip: Modify the code above and click “Run” to see the results

Learn More

Related Terms