hoisting
lifts identifiers to top of scope.
Last updated
Was this helpful?
lifts identifiers to top of scope.
Last updated
Was this helpful?
โฉ โฉ hoisting
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 ""โ๏ธ
const requires initialization - must have with initial valueโ๏ธ
function hoisting - declaration hoisted, value initialized to a function.
lexical declaration ( let / const / class )
is "" 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).
replit๏ผ
โฉ
Ch. 5 โฉ