IT lexicon › Programming › Hoisting

Hoisting

Programming På svenska → Updated: 2026-07-30

JS phenomenon: variable and function declarations are "hoisted" to the top of their scope at compile time.

var x is declared before the code runs, but the value assignment happens where written. function f() is fully hoisted. let/const are also hoisted (in the "TDZ" — Temporal Dead Zone) but cannot be used before declaration. Classic JS gotcha.

← Back to the lexicon