Frameworks come and go, but a handful of core JavaScript concepts show up in every single one of them. Skip these and you'll spend your career debugging by trial and error instead of understanding.
Values vs. references
Primitives (strings, numbers, booleans) are copied by value; objects and arrays are copied by reference. This single distinction explains a huge share of "why did my state change unexpectedly" bugs in React and every other framework.
let a = { count: 1 };
let b = a;
b.count = 2;
console.log(a.count); // 2 — a and b point to the same object
Closures: functions remember where they were born
A closure is just a function that keeps access to variables from the scope it was created in, even after that scope has finished running. This is how you build private state, counters, and memoized functions without any special syntax.
function makeCounter() {
let count = 0;
return () => ++count;
}
const counter = makeCounter();
counter(); // 1
counter(); // 2
The event loop, in one paragraph
JavaScript runs on a single thread, but it doesn't block on slow operations. Instead, things like network requests, timers, and promises get handed off, and their callbacks are queued to run only once the current synchronous code has finished. That's why a setTimeout(fn, 0) still runs after all your regular code, not immediately.
Microtasks jump the queue
Promise callbacks (microtasks) run before timer callbacks (macrotasks), even if the timer was scheduled first. This ordering trips people up constantly when debugging async code, so it's worth testing for yourself in the console at least once.
Equality has two flavors
== converts types before comparing; === does not. Modern style guides essentially ban == for this reason — it's rarely worth the surprising conversions ('' == 0 is true, for example). Default to === and you'll sidestep an entire category of bugs.
Async/await is just promises with better syntax
Under the hood, async functions always return a promise, and await pauses execution until that promise settles. Nothing new is happening — it's the same event loop and the same microtask queue, just easier to read than chained .then() calls.
The takeaway
Frameworks are built on top of these fundamentals, not instead of them. An hour spent genuinely understanding closures and the event loop will save you far more debugging time than another tutorial on this month's trendiest library.
Keep reading
Related articles
How to Learn React in 30 Days (A Realistic Roadmap)
A day-by-day plan that takes you from JavaScript basics to building and deploying your first real React app.
Git Without the Fear: A Practical Mental Model
Stop memorising commands. Understand what Git actually does and the day-to-day workflow clicks into place.
Reading Documentation Like a Senior Engineer
Docs aren't meant to be read start-to-finish. Here's how experienced devs actually navigate them.
Discussion
Leave a comment
Your email stays private and is never published.