Loading...
Loading...
Master the runtime mechanics that trip up most developers: hoisting, scope resolution, prototypes, this binding, and module loading.
See how JavaScript processes your code in two distinct phases.
1console.log(a); // undefined (var hoisted)2console.log(b); // ReferenceError (TDZ)3console.log(greet); // function (hoisted)45var a = 10;6let b = 20;7const c = 30;89function greet() {10 return "hello";11}
let and const are hoisted but remain uninitialized. Accessing them before their declaration throws a ReferenceError.Follow the variable lookup path through lexical environments.
1const global = "🌍";23function outer() {4 const outerVar = "outer";56 function middle() {7 const middleVar = "middle";89 function inner() {10 const innerVar = "inner";11 console.log(innerVar); // ✓ found in inner12 console.log(middleVar); // ✓ found in middle13 console.log(outerVar); // ✓ found in outer14 console.log(global); // ✓ found in global15 console.log(missing); // ✗ ReferenceError16 }17 inner();18 }19 middle();20}
See how JavaScript traverses the prototype chain to find properties.
Understand how JavaScript determines what `this` refers to.
1// Global context2function showThis() {3 console.log(this);4}56showThis(); // Called without object
Understand how ES modules are resolved and executed.
1. JS engine builds the full import graph
2. Resolves dependencies depth-first
3. Executes leaf modules first (no dependencies)
4. Works up to the entry point
Circular imports are handled by returning partial exports.