Skip to content

Lesson 12 of 32Technical rounds

Frontend Interview Rounds

Pass JavaScript utility, UI coding and frontend system design rounds by knowing what each one scores and practicing the classic prompts.

19 min read0/5 questions

You applied for a frontend role and the loop has three technical rounds: "JavaScript", "UI coding" and "frontend system design". None of them is a LeetCode round in disguise. The first asks you to rebuild a piece of the language or browser, the second asks you to build a working widget in 45 minutes, and the third asks you to architect a product screen. Each has its own rubric, and candidates who prepare only algorithms tend to fail all three. This lesson shows what each round looks like, what earns credit, and works through the prompts that come up again and again.

The three round types

RoundTypical promptWhat it really tests
JavaScript fundamentalsImplement Promise.all, debounce, throttle, an EventEmitter, deep clone, curryClosures, async, the event loop, edge cases in the language
UI codingBuild an autocomplete, modal, tabs, star rating, infinite list, sortable tableWorking code under time pressure, plus accessibility, state and edge cases
Frontend system designDesign a news feed, image carousel, chat app, or Google Docs-style editorComponent architecture, data flow, rendering strategy, performance, trade-offs

Some companies add a fourth: a general web quiz on how browsers work, CORS, cookies and performance. Others fold those questions into the rounds above. At big tech, frontend candidates often still get one standard algorithms round too, so do not drop that practice entirely.

Two variations to ask your recruiter about:

  • Framework or vanilla? Some UI rounds let you use React. Others forbid frameworks entirely to see whether you know the DOM underneath. If you have only ever written React, practice document.createElement, addEventListener, event delegation and manual re-rendering before the interview.
  • Runnable editor or not? Many UI rounds use an editor with a live preview. Some use a plain shared document. Ask, and practice in the same setup.

JavaScript fundamentals: rebuild the platform

These prompts look small, but each hides two or three edge cases that separate a pass from a strong pass. You saw debounce and deep copy in JavaScript and TypeScript Questions. Here is the most common async one: implement Promise.all.

The spec in plain words: take an iterable of values or promises; resolve with an array of results in input order, once all have resolved; reject as soon as any rejects; resolve immediately with [] for empty input; and treat plain values as already resolved.

JavaScriptpromise_all.js
function promiseAll(items) { return new Promise((resolve, reject) => { const results = new Array(items.length); let remaining = items.length; if (remaining === 0) return resolve(results); items.forEach((item, i) => { Promise.resolve(item).then((value) => { results[i] = value; // by index, not push: keeps input order remaining -= 1; if (remaining === 0) resolve(results); }, reject); // first rejection wins; later ones are ignored }); });} const wait = (ms, value, fail = false) => new Promise((res, rej) => setTimeout(() => (fail ? rej(new Error(value)) : res(value)), ms)); promiseAll([wait(30, "slow"), wait(10, "fast"), 42]).then((r) => console.log("ok:", r.join(", ")));promiseAll([]).then((r) => console.log("empty:", r.length));promiseAll([wait(20, "a"), wait(5, "boom", true)]).catch((e) => console.log("rejected:", e.message));
Output
Press Run (⌘ Enter) to see what happens.

The points interviewers listen for:

  • results[i] = value, not push. Promises settle in any order. Pushing gives you completion order, which is the most common bug.
  • A counter, not results.length. Assigning results[2] first makes length 3 straight away, so checking length would resolve early.
  • Promise.resolve(item) wraps plain values and other thenables, so 42 works.
  • Empty input resolves immediately. Without the early return, the promise never settles.
  • Calling resolve or reject twice is harmless, because a promise settles once. Say that out loud; it shows you know the semantics.

Follow-ups often ask for Promise.allSettled (never rejects, returns {status, value} or {status, reason} objects), Promise.race or Promise.any, or a version with a concurrency limit: "run at most 3 requests at a time". That last one is a real-world favourite because it is exactly what you need when uploading 200 files.

Predict the outputJavaScript

What does this print?

const wait = (ms, v) => new Promise((r) => setTimeout(() => r(v), ms));

Promise.all([wait(30, "A"), wait(10, "B"), "C"])
.then((r) => console.log(r.join(" ")));
Need a nudge? Hints walk you through it.
Model answer: an EventEmitter with on, off and once

Another regular. The traps are once (the wrapper must remove itself, and off must still work), and removing a handler while emit is looping over the list.

JavaScriptevent_emitter.js
class EventEmitter { #listeners = new Map(); // event name -> array of handlers on(event, handler) { if (!this.#listeners.has(event)) this.#listeners.set(event, []); this.#listeners.get(event).push(handler); return () => this.off(event, handler); // handy unsubscribe function } off(event, handler) { const list = this.#listeners.get(event); if (!list) return; const i = list.indexOf(handler); if (i !== -1) list.splice(i, 1); } once(event, handler) { const wrapper = (...args) => { this.off(event, wrapper); handler(...args); }; return this.on(event, wrapper); } emit(event, ...args) { // Copy first: a handler that calls off() must not skip its neighbour for (const handler of [...(this.#listeners.get(event) ?? [])]) { handler(...args); } }} const bus = new EventEmitter();const stop = bus.on("save", (doc) => console.log("logger saw", doc));bus.once("save", (doc) => console.log("once saw", doc));bus.emit("save", "draft-1");bus.emit("save", "draft-2");stop();bus.emit("save", "draft-3");console.log("done");
Output
Press Run (⌘ Enter) to see what happens.

Without the copy in emit, the once wrapper removes itself mid-loop, the array shifts left, and the handler after it is skipped. That is a real bug in hand-rolled emitters, and naming it is a strong signal.

UI coding: the rubric

UI coding rounds are scored in a fairly consistent order. Get the earlier rows right before polishing the later ones.

  1. It works. The core interaction, end to end, with no console errors. A beautiful half-widget scores below an ugly working one.
  2. State shape. Minimal state, everything else derived. For a sortable table, store rows, sortKey and sortDir, and compute the sorted rows. Do not store a second sorted copy that can drift.
  3. Edge cases. Empty results, loading, errors, very long text, rapid input, double clicks.
  4. Accessibility. Semantic elements first (button, input, label, ul), then ARIA only where no native element fits, keyboard support, visible focus, and focus management for overlays.
  5. Performance. Debounced input, no work on every keystroke that could wait, virtualisation for very long lists.
  6. Code quality. Clear names, small functions, a sensible split into components.

Accessibility is not optional polish. At many companies it is an explicit rubric row for frontend roles, and it is where strong candidates separate themselves. For a modal, that means role="dialog" with aria-modal="true" and a label (or the native <dialog> element with showModal()), focus moving into the dialog on open, focus trapped inside while open, Escape closing it, and focus returning to the button that opened it. The Keyboard Support and Focus Management and ARIA Widget Patterns lessons cover the patterns in depth; in the interview, saying them as you build is what earns credit.

The fastest route to good accessibility is to use native elements. A star rating is a good example: it looks custom, but semantically it is a group of radio buttons. Build it on real radio inputs and you get keyboard support, form submission and screen reader announcements for free.

HTML & CSS
<fieldset class="rating"> <legend>Rate this recipe</legend> <input type="radio" id="r1" name="rating" value="1"><label for="r1"><span>1 star</span></label> <input type="radio" id="r2" name="rating" value="2"><label for="r2"><span>2 stars</span></label> <input type="radio" id="r3" name="rating" value="3"><label for="r3"><span>3 stars</span></label> <input type="radio" id="r4" name="rating" value="4"><label for="r4"><span>4 stars</span></label> <input type="radio" id="r5" name="rating" value="5"><label for="r5"><span>5 stars</span></label></fieldset><p id="out" aria-live="polite">No rating yet. Click a star, or Tab in and use the arrow keys.</p> <style> body { font-family: system-ui, sans-serif; background: #111; color: #eee; padding: 16px; } .rating { border: 0; padding: 0; display: flex; gap: 4px; } .rating legend { margin-bottom: 8px; } .rating input { position: absolute; opacity: 0; width: 1px; height: 1px; } .rating label { width: 32px; height: 32px; cursor: pointer; background: #555; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); } .rating label span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .rating label.on { background: #f5c518; } .rating input:focus-visible + label { outline: 3px solid #6cf; outline-offset: 2px; }</style> <script> const labels = [...document.querySelectorAll(".rating label")]; document.querySelector(".rating").addEventListener("change", (e) => { const value = Number(e.target.value); labels.forEach((label, i) => label.classList.toggle("on", i < value)); document.getElementById("out").textContent = `You rated it ${value} out of 5.`; });</script>

Preview

Notice what is not there: no tabindex, no keydown handler, no role="radio". The browser handles arrow keys and announces "3 stars, radio button, 3 of 5". One change listener on the parent fieldset handles all five inputs, which is event delegation, a concept interviewers often probe directly.

The autocomplete, and the race condition everyone misses

Autocomplete (typeahead) is the most common UI prompt because it touches everything: input handling, debouncing, async data, keyboard navigation, accessibility and a subtle race condition.

The race: the user types r, re, rea. Three requests go out. Responses do not have to come back in order. If the response for r arrives last, the list shows results for r while the input says rea. Debouncing makes it rarer but does not remove it. Run this to see it happen:

JavaScriptautocomplete_race.js
// A fake search API: shorter queries are slower, like a real server// scanning more matches. It honours an AbortSignal like fetch does.function fakeSearch(q, signal) { const delay = { r: 60, re: 40, rea: 20 }[q] ?? 10; return new Promise((resolve, reject) => { const t = setTimeout(() => resolve(`results for "${q}"`), delay); signal?.addEventListener("abort", () => { clearTimeout(t); reject(new DOMException("Aborted", "AbortError")); }); });} // Naive: every response writes to the screen, whenever it landslet naiveScreen = "";function naiveOnInput(q) { fakeSearch(q).then((r) => { naiveScreen = r; });} // Fixed: abort the previous request before starting a new onelet screen = "";let controller = null;function onInput(q) { controller?.abort(); controller = new AbortController(); fakeSearch(q, controller.signal) .then((r) => { screen = r; }) .catch((e) => { if (e.name !== "AbortError") throw e; });} for (const q of ["r", "re", "rea"]) { naiveOnInput(q); onInput(q); } setTimeout(() => { console.log("typed: rea"); console.log("naive shows:", naiveScreen); console.log("fixed shows:", screen);}, 100);
Output
Press Run (⌘ Enter) to see what happens.

Two fixes, and naming both is ideal:

  • Abort the previous request with an AbortController, as above. fetch accepts a signal, and aborting rejects the old promise with an AbortError, which you ignore. This also saves the server and the network.
  • Ignore stale responses by tagging each request with an id or the query, and only applying a response if it matches the latest one. This works even for APIs you cannot cancel.

The rest of the autocomplete checklist: debounce input (around 200 to 300 ms is a sensible starting point), skip the request for empty input, cache results per query so backspacing is instant, show loading, empty and error states, and support the keyboard. Accessibly, the input is a combobox: role="combobox" with aria-expanded, aria-controls pointing at a role="listbox", and aria-activedescendant naming the highlighted role="option" while focus stays in the input. Up and Down move the highlight, Enter selects, Escape closes.

Quick check
Your autocomplete is debounced at 300 ms, yet users occasionally see results for an earlier, shorter query. Why, and what fixes it?
Need a nudge? A hint rules out a wrong answer.

Frontend system design

Frontend system design asks you to design a product surface, not a backend. Interviewers do not want load balancers and sharding. They want components, data flow, the client-server contract and performance. A common framework is RADIO: Requirements, Architecture, Data model, Interface, Optimisations. The name comes from a popular prep resource, and other structures work just as well, as long as you cover the same ground in a sensible order.

Designing a news feed, RADIO style
Requirements: scope, devices, scaleRequirementsscope, devices, scaleArchitecture: components + storeArchitecturecomponents + storeData model: normalised client storeData modelnormalised client storeInterface: cursor-paged APIInterfacecursor-paged APIOptimisations: virtualise, prefetch, a11yOptimisationsvirtualise, prefetch, a11y

Requirements (about 5 min). Infinite scroll of posts with text and images, like and comment, new posts appear. Mobile web and desktop. Out of scope: creating posts, ads. Non-functional: fast first load, smooth scrolling, works on slow phones.

1/5

Topics that come up in almost every frontend design round, with the trade-off to name:

  • Rendering strategy. Client-side rendering (fast navigation after load, slow first paint, weak for SEO), server-side rendering (fast first paint and SEO, more server work), static generation (fastest, only for content that rarely changes), and React Server Components (less JavaScript shipped, server data access, needs a framework that supports them). Pick per page, with a reason.
  • Pagination. Cursor-based for feeds and anything that changes while you scroll; offset for stable, numbered pages like admin tables.
  • Caching and freshness. A query cache with stale-while-revalidate, when to refetch (focus, interval, after mutations), and optimistic updates for likes and toggles.
  • Real time. Polling (simple, wasteful), server-sent events (one-way, simple), WebSockets (two-way, for chat). Say which fits and why.
  • Offline and slow networks. Retry with backoff, queued writes, a service worker if offline is a requirement.
  • Internationalisation. Text expansion, right-to-left layouts, locale-aware dates and numbers.
  • Accessibility. Keyboard paths, focus management, announcements for new content.
Match the pairs0/5 matched

Match each design decision to the reason you would give for it.

Choose an item, then its match on the other side.

Web fundamentals they probe

Expect some of these as standalone questions or as follow-ups inside the other rounds.

Event delegation. One listener on a parent handles events from many children, using event.target (often with closest()) to find which one. It uses less memory and works for children added later. It is the right answer for "attach a click handler to 10,000 list items".

The critical rendering path. HTML is parsed into the DOM, CSS into the CSSOM, they combine into the render tree, then layout, paint and composite. CSS blocks rendering; a plain <script> blocks parsing, which is why scripts use defer or type="module". Changing transform or opacity can skip layout and paint, which is why animations should use them.

Core Web Vitals. The three Google uses are LCP (Largest Contentful Paint, loading), INP (Interaction to Next Paint, responsiveness) and CLS (Cumulative Layout Shift, visual stability). INP replaced FID as a Core Web Vital in March 2024. FID only measured the delay before the first interaction's handler started; INP looks at the latency of interactions across the whole visit, through to the next paint. Check web.dev for the current thresholds rather than memorising numbers.

CORS. The browser blocks a page from reading responses from another origin unless the server allows it with Access-Control-Allow-Origin. Non-simple requests (custom headers, PUT, JSON content type) trigger a preflight OPTIONS request first. CORS protects users' data in the browser; it is not server-side security, because curl ignores it.

Cookies vs storage for tokens. localStorage is readable by any script on the page, so an XSS bug can steal tokens stored there. An HttpOnly, Secure cookie cannot be read by scripts, and SameSite limits cross-site sending, which helps against CSRF. The usual answer for session tokens is the cookie, with CSRF protection where needed.

Quick check
A product page feels sluggish: the Add to cart button takes almost a second to respond on mid-range phones because a large script runs on each click. Which Core Web Vital captures this?
Need a nudge? A hint rules out a wrong answer.
Put it in order5 steps

You have 45 minutes to build a modal. Put your priorities in the order a strong candidate tackles them.

  1. Tap the steps below in the right order.
Need a nudge? A hint shows where it starts.

How to practice

  • Write the utilities from memory, with tests: debounce, throttle, Promise.all, allSettled, a concurrency-limited runner, EventEmitter, deep clone with cycles, curry, flatten. Time yourself at 15 to 20 minutes each.
  • Build five widgets twice, once in React and once in plain DOM: autocomplete, modal, tabs, sortable table, infinite list. Test each with only a keyboard, then with a screen reader for a few minutes.
  • Do two frontend design questions out loud each week, with a timer, covering all five RADIO areas. Record yourself and listen for choices you made without a reason.
  • Keep React Interview Questions and JavaScript and TypeScript Questions nearby for the concept questions that come up between the coding.
Key terms
UI coding round
An interview where you build a working interface widget, such as an autocomplete or modal, in about 45 minutes.
frontend system design
An interview about designing a product surface: components, data flow, API contract, rendering strategy and performance.
RADIO
A frontend design framework: Requirements, Architecture, Data model, Interface, Optimisations.
event delegation
Handling events from many child elements with one listener on a parent, using the event target to tell them apart.
race condition (UI)
Async responses arriving out of order so an older result overwrites a newer one, as in an unguarded autocomplete.
AbortController
A browser and Node API that cancels an in-flight fetch or other operation through an AbortSignal.
INP
Interaction to Next Paint, the Core Web Vital for responsiveness, which replaced FID in March 2024.