๐ฐhoisting
lifts identifiers to top of scope.
hoists identifiers to the top of a scope (at compile-time)
var hoisting - declaration hoisted, value initialized to "undefined".
let/const/class hoisting - declaration hoisted, value "uninitialized"โ๏ธ
const requires initialization - must have with initial valueโ๏ธ
function hoisting - declaration hoisted, value initialized to a function.
lexical declaration ( let / const / class )
is "uninitialized" first (at compile-time).
then initialized to its initial value (when execution reaches its declaration at runtime)โ
there's a temporal dead zone between these two states, be awareโ
hoisting priority
function declaration is hoisted first (function hoisting).
Last updated