Skip to Content
0 likes
Closures for Private State: A Counter You Can't Break Level: Advanced

Keep a counter's value in a closure so nothing outside can set it to -5 or "abc". The pattern, how it compares with a class with

0 likes
Fix a Bound Event Listener That Will Not Detach Level: Advanced

Trace a wrong callback receiver, bind one stable listener, and verify start, stop and restart without duplicate or stale subscriptions.

0 likes
Predict the Output: Event Loop Order in 6 Snippets Level: Advanced

Six short snippets with setTimeout, promises, await and queueMicrotask. Predict the order, run it, then read why. The one rule: sync code first, then all microtasks, then the next task.

0 likes
Batch API Calls With Promise.allSettled Level: Advanced

Send many requests, keep the successes, and report the failures instead of losing everything to one rejected promise. Plus limiting how many run at once.

0 likes
Add a Timeout to fetch With AbortController Level: Advanced

fetch has no timeout option and can wait a very long time. AbortSignal.timeout(ms) fixes that in one line, and AbortSignal.any combines it with a cancel button.

0 likes
Paginate an API With an Async Generator Level: Advanced

Hide page numbers and "next" links inside an async generator, then loop over every record with for await. Stop early and the remaining pages are never fetched.

0 likes
Process a Large CSV in Node.js With Streams Level: Advanced

Read a CSV too big for memory line by line with readline, total a column, and write a filtered copy with pipeline. Memory stays flat no matter how big the file is.

0 likes
Type-Check Plain JavaScript With JSDoc and @ts-check Level: Advanced

Add // @ts-check to the top of a file and JSDoc types to your functions, and the TypeScript checker flags wrong arguments in your editor and in CI. No build step, no .ts files.

0 likes
Add ESLint to an Existing Project Without 500 Errors Level: Advanced

Start with the recommended rules, fix what's automatic, turn noisy rules into warnings, and make CI fail only on new problems. The linter becomes useful on day one instead of ignored.

0 likes
Build and Publish a Small npm Package Level: Advanced

Set up name, version, exports and files in package.json, check exactly what ships with npm pack --dry-run, then publish with npm publish. Mistakes in a published version can't be undone.

0 likes
Find a Retained Detached DOM Node With Heap Snapshots Level: Advanced

Trace a detached preview from its DOM node to an application Map, repair cleanup, and verify repeated open-and-close cycles with heap snapshots.

0 likes
Find the Slow Function With Chrome's Performance Profiler Level: Advanced

Record one slow click in Chrome's Performance panel, read the Bottom-up tab by self time, fix the function it points at, and record again to prove the fix worked.