forEach and async/await: Why Your Loop Doesn't Wait
forEach with async/await doesn't wait. It starts every callback and returns undefined, so your code moves on early and errors skip your try/catch. Use for...of or Promise.all.

Practical, diagram-first explanations you can read over coffee. 85 posts and counting.
Newest postIdempotency means doing something twice has the same effect as doing it once. Learn how idempotency keys make retries safe, and why PUT is idempotent but POST isn't.
forEach with async/await doesn't wait. It starts every callback and returns undefined, so your code moves on early and errors skip your try/catch. Use for...of or Promise.all.

Server first, browser second. Render goes down the tree, effects come back up. The order of every hook from request to state update, measured.

If you can calculate a value from props or state, it isn't state. Copying it with useEffect costs an extra render and shows a stale value first.

Boolean and !! match. Number and + match, except a BigInt. String(null) is "null"; null.toString() throws.

as const keeps the exact value. satisfies checks a type and keeps it. as replaces the type. is narrows it when a check returns true.

A barrel re-exports a whole folder. Tree shaking may still drop unused code, but the bundler often walks every file behind that index first.

var and let are both registered when the scope starts. var is already undefined. let stays untouchable until its line runs.

The collector paints every object reachable from the stack and globals. Whatever the paint misses is unused, even if objects still point at each other.

Short posts on one theme, meant to be read in order. Each part stands alone, and together they build the full picture.
Get new posts in your inbox
One email when a new post is out: short, diagram-first explanations of JavaScript, React and Next.js. No spam, unsubscribe any time.