Frontend System Design: Build an Autocomplete
A structured walkthrough of the autocomplete design round: requirements, architecture, race-free fetching, caching, rendering, the ARIA combobox and metrics.
Clear, friendly notes on the JavaScript, TypeScript, React & Angular questions that come up again and again, with the reasoning written in the margins. Then practice them like it's the real interview.
function outer() { let count = 0; return function inner() { return ++count; }; } const next = outer(); next(); // 1 next(); // 2 ← why not 1?!
Closures, hoisting, prototypes & the event loop.
Generics, narrowing, utility & mapped types.
Hooks, rendering, memoization & state.
Change detection, DI, signals & RxJS.
Semantics, the box model, layout & a11y.
Debounce, Promise.all, LRU cache… write it, run the tests.
Event loop phases, streams & modules.
OOP, collections, JVM, concurrency & streams.
IoC, auto-configuration, JPA, REST & security.
Data model, generators, decorators & the GIL.
Service design, messaging, resilience & sagas.
Loading today's question…
A structured walkthrough of the autocomplete design round: requirements, architecture, race-free fetching, caching, rendering, the ARIA combobox and metrics.
What lexical scope and closures really are, why the var + setTimeout loop prints 3 3 3, three ways to fix it, and where closures earn their keep in real code.
Ten generics questions, from constraints and keyof to infer, distributive conditional types and variance, each with a short answer and code you can reproduce.
How the call stack, task queue and microtask queue fit together, where rendering happens, how async/await schedules work, and output puzzles with answers.
Stale closures, missing cleanup, fetch races, Strict Mode's double run, infinite loops and effects you don't need, plus how useLayoutEffect differs in timing.
How JavaScript decides what this refers to: default, implicit, explicit and new binding, the order they win in, why arrow functions ignore them, and the bugs that follow.
One tricky interview question, fully explained. Takes 5 minutes to read with your coffee.