JavaScript
6 posts
JavaScript's this: who is it actually pointing at?
A walkthrough of the four binding rules for this and the priority order between them, plus why arrow functions don't get to decide their own this — so you can look at any snippet and know exactly what this points to.
A Mental Model for the JavaScript Event Loop
Build a rock-solid mental model for the call stack, Web APIs, macrotasks, and microtasks — so you never get confused about when a line of code actually runs.
A Complete Guide to Promises and Async/Await
Starting from the pain of callback hell, break down Promise's three states and chainable .then, see how async/await wraps asynchronous code in a synchronous-looking syntax, and walk away with practical patterns for error handling and running things in parallel.
Understanding JavaScript Closures: Why Can a Function Remember Outer Variables?
Break down how JavaScript closures work through the classic loop trap, understand how functions "remember" variables in their lexical scope, and learn to use them for real-world patterns like counters and data privacy.
Hoisting: What's Actually Getting Hoisted
A deep dive into how hoisting really works — why var comes back undefined, why let and const throw instead, and why you can call a function before you've even written it.
var vs let vs const: Which One Should You Actually Use?
Breaking down how var, let, and const really differ — scope, hoisting, the temporal dead zone — and building a practical rule of thumb for which one to reach for.