π INDEX
LOADING ENGINE...
JS Hoisting
Understand how JavaScript allocates memory before code execution.
hoisting.js
π
JS Engine is parsing variables...
A.D.A: In JavaScript, Hoisting is a behavior where variable and function declarations are moved to the top of their containing scope during the compilation phase.
The Concept
Hoisting is JavaScript's default behavior of moving declarations to the top. However, only the declarations are hoisted, not the initializations.
// What you write:
console.log(cat); var cat = "Meow";
// How JS interprets it:
var cat;
console.log(cat); // undefined
cat = "Meow";
Hoisting Glossary
Temporal Dead Zone (TDZ)
The period between entering the scope and the actual variable declaration where let/const cannot be accessed.
Lexical Environment
Where the JS engine holds variables and function declarations during the memory creation phase.