The short version. A frontend developer interview isn't a generic coding test — it's a craft interview. JavaScript rounds probe whether you truly understand the language and the browser runtime, not just a framework's API. The UI-build round watches you implement a real, interactive component live, where CSS, semantics, and accessibility all show up at once. Applied rounds score your judgment on performance, rendering, and accessible markup. The behavioral round scores how you collaborate with design and backend and how you own the user experience. Below are 14 real questions across all of these, each with why the interviewer asks it and a strong sample answer — plus a preparation plan, the red flags that sink strong coders, and the questions you should ask back.
What a frontend developer interview really tests
A frontend interview is easy to misjudge. Candidates assume it's a watered-down software-engineering loop with a bit of CSS bolted on, then walk out surprised by how much the rounds reward something the generic algorithm grind never trains: craft on the platform itself. What an experienced frontend interviewer is actually evaluating is whether you understand the medium you work in — the language, the browser, the box model, the render pipeline, the user sitting on the other side of a slow phone — and whether you can turn a Figma file into an interface that's fast, accessible, and maintainable while narrating your decisions.
So treat the loop as a set of distinct competencies, not one big puzzle. JavaScript rounds probe language and runtime depth — closures, the event loop, async behavior — because a developer who only knows a framework breaks the moment the framework leaks. The UI-build round probes craft under observation: can you build a real, interactive widget that works with a keyboard, not just a mouse. Applied rounds probe judgment on performance and accessibility, where there's rarely one right answer. And the behavioral round asks whether you can partner with designers and backend engineers without becoming the bottleneck. Knowing which competency a question measures tells you what to emphasize when you answer.
How the rounds are structured
A modern frontend loop is fairly recognizable whether you're targeting a large product company, a design-led startup, or an agency. The names vary, but the shape rarely does — and unlike a backend loop, at least one round will almost always have you building real UI in a real browser. Understanding the sequence lets you allocate prep time where it counts and walk in knowing exactly what each interviewer is scoring.
| Round | Format | What it scores |
|---|---|---|
| Recruiter screen | 20–30 min call | Motivation, level fit, comp range, logistics |
| Technical phone screen | 45–60 min, shared editor | JavaScript and DOM fundamentals; can you reason out loud |
| UI build round | 60 min, live in a browser sandbox | Implement an interactive component — state, events, CSS, semantics |
| JavaScript / algorithms | 45–60 min | Language depth, data manipulation, complexity |
| Applied frontend | 45 min | CSS layout, accessibility, performance, browser behavior |
| Behavioral / values | 45 min | Collaboration with design & backend, ownership of UX |
For junior roles, the algorithms round is usually lighter and the UI-build round carries the most weight — they want to see you can ship a working component. For senior and staff frontend roles, the balance shifts toward architecture: how you'd structure a design system, manage shared state across a large app, set a performance budget, and lead accessibility as a team standard. Match your preparation to the level you're targeting — grinding hard algorithm puzzles when you're interviewing for a senior frontend role with a component-architecture loop is a common and costly misallocation.
JavaScript & browser questions
The JavaScript round is where teams separate developers who truly know the language from those who only know a framework's surface. The interviewer wants to hear you connect a concept to why it matters in real code — not recite a definition. The strongest answers tie language behavior back to a bug you've actually debugged. Here are the most representative questions, with what's really being measured and how a strong candidate answers.
1. What is a closure, and where have you actually used one?
Why they ask it: closures are the foundation of half of practical JavaScript — module patterns, event handlers, hooks, debounce. They want to confirm you understand why a function "remembers" its scope, and the "where have you used one" half is what separates memorizers from people who write real code.
Strong sample answer"A closure is a function bundled together with the variables from the scope where it was defined — so even after that outer scope has returned, the inner function still has live access to those variables. The classic gotcha is a loop that creates handlers: with var, every handler closes over the same shared variable and they all log the final value; with let, each iteration gets its own binding, so they capture distinct values. Where I use closures constantly is anything stateful-but-private — a debounce function that keeps a timer ID across calls, or a counter factory. In React, every hook is leaning on closures, which is exactly why a stale closure over old state inside a useEffect is such a common bug."
2. Walk me through what the event loop does, and the difference between a microtask and a macrotask.
Why they ask it: the event loop is the single concept that explains async behavior, why the UI freezes during heavy work, and surprising ordering bugs. Distinguishing microtasks from macrotasks is the senior-level signal — it predicts whether your promise ordering will be correct.
Strong sample answer"JavaScript runs on a single thread with one call stack, so the event loop is the mechanism that lets it do non-blocking work. When the stack is empty, the loop pulls the next queued callback and runs it. The key nuance is two queues: the macrotask queue holds things like setTimeout callbacks and DOM events, while the microtask queue holds promise .then callbacks and queueMicrotask. After every single task, the engine drains the entire microtask queue before rendering or taking the next macrotask. That's why a resolved promise's callback runs before a setTimeout(fn, 0) queued earlier. It also explains a real performance trap: a runaway chain of microtasks can starve rendering and freeze the page, because the browser never gets a chance to paint between them."
3. Implement a debounce function.
Why they ask it: it's the perfect small frontend problem — it combines closures, timers, the event loop, and this/argument forwarding in one task you'd genuinely write at work (search-as-you-type, resize handlers). It reveals far more than its size suggests.
"Debounce delays running a function until it's stopped being called for a given wait — so a search input only fires the request after the user pauses typing. I keep a timer ID in a closure; each call clears the pending timer and schedules a new one. I forward arguments and preserve this so it works as a method too. I'd mention you sometimes want a leading-edge variant that fires immediately, and that throttle is the cousin that fires at most once per interval — I'd ask which behavior they want."
function debounce(fn, wait) {
let timer; // kept alive by the closure
return function (...args) {
clearTimeout(timer);
timer = setTimeout(() => {
fn.apply(this, args); // preserve this + arguments
}, wait);
};
}
4. What's the difference between == and ===, and when is loose equality ever acceptable?
Why they ask it: it's a fast probe of whether you understand type coercion, one of JavaScript's most bug-prone corners. The mature answer isn't "never use ==" — it's knowing the one or two cases where it's deliberate.
"=== compares value and type with no coercion; == coerces the operands to a common type first, which produces surprises like '' == 0 or [] == false being true. My default is always === because it's predictable and lint rules enforce it. The one place I'll deliberately use loose equality is the idiom x == null, which is a concise way to check for both null and undefined in a single comparison. Outside that, coercion bugs cost more than the keystrokes saved, so I keep it explicit."
useEffect bites you" is a hire signal.CSS, layout & accessibility questions
The applied round is where frontend interviews diverge most sharply from generic engineering loops. Strong teams treat CSS fluency and accessibility as core competencies, not nice-to-haves — and being vague here is a reliable down-rank at senior level. The interviewer wants concrete, mechanism-level answers, not buzzwords.
5. When would you reach for Flexbox versus Grid, and how do you center an element?
Why they ask it: layout is the daily work of frontend, and a confident, correct answer signals you build interfaces without fighting the browser. The "center an element" follow-up is a classic — it instantly reveals whether modern CSS is muscle memory or guesswork.
Strong sample answer"I think of it by dimensionality. Flexbox is for laying out items along one axis — a nav bar, a toolbar, a row of cards that wraps — where I care about distribution and alignment in a single direction. Grid is for two-dimensional layout where I'm placing things into rows and columns at once, like a page shell or a card gallery with aligned tracks. They compose well: a Grid page with Flex inside each cell. For centering, the modern answer is one rule — display:grid; place-items:center on the parent, or display:flex; align-items:center; justify-content:center. I'd avoid the old absolute-position-and-transform hack unless I specifically need it, since it's harder to maintain."
6. Explain specificity and the box model — and how you'd debug an element that's "the wrong size."
Why they ask it: specificity and the box model are the two things that cause the most "why won't this style apply / why is this too wide" frustration. They want to see you debug methodically with dev tools rather than pile on !important.
"Specificity is how the browser breaks ties between conflicting rules — inline styles beat IDs, which beat classes and attributes, which beat element selectors; !important overrides the lot and is a smell I avoid because it starts an arms race. The box model is how an element's total size is computed from content, padding, border, and margin. The single most common 'too wide' bug is forgetting box-sizing:border-box, so padding and border add onto the declared width instead of being included. To debug a wrong-size element I open dev tools, inspect the computed box diagram to see exactly which layer is adding pixels, and check the Styles pane to see which rule won and why — that beats guessing every time."
7. How would you make a custom dropdown or modal accessible?
Why they ask it: custom widgets are where accessibility usually breaks, and building one correctly is a strong senior signal. It tests semantic HTML, keyboard support, focus management, and whether you reach for ARIA appropriately rather than sprinkling it everywhere.
Strong sample answer"My first instinct is to use the platform — a native <select> or <dialog> gives you accessibility for free, so I only build a custom widget when design genuinely requires it. When I do, I follow the established pattern. For a modal: it needs role=\"dialog\" and aria-modal, focus must move into it on open and return to the trigger on close, focus must be trapped inside while it's open, Escape must close it, and the background content should be inert so a screen reader doesn't wander into it. For a dropdown, the trigger needs aria-expanded, options are navigable with arrow keys, Enter selects, and Escape closes. The principle is: semantics first, manage focus deliberately, support the keyboard, and only add ARIA to fill the gaps the native element would have covered."
8. What does WCAG actually ask of you day to day, and how do you test for it?
Why they ask it: they want to know accessibility is a habit, not a checkbox you tick before launch. Naming concrete, testable criteria — and a real testing workflow — separates developers who ship accessible UI from those who say the word.
Strong sample answer"Day to day, WCAG comes down to a handful of habits: meaningful text alternatives for images, color contrast that meets the AA ratio, every interactive element reachable and operable by keyboard with a visible focus indicator, form inputs with associated labels, and not relying on color alone to convey meaning. I test in layers — an automated pass with an in-browser auditor to catch the obvious misses, then the test that finds the real problems: I unplug the mouse and tab through the whole flow, and I run a screen reader over the key paths. Automated tools only catch maybe a third of issues, so the keyboard-and-screen-reader pass is the one that actually matters."
<dialog> before I hand-rolled a modal" is exactly the judgment interviewers are listening for.React & component questions
Most frontend roles today are framework roles, and React dominates the field. The interviewer isn't checking whether you've memorized the API — they're checking whether you understand the model underneath it, because that's what lets you debug the weird re-render and structure an app that doesn't rot. Answer these by explaining the mechanism, then the practical consequence.
9. Explain the virtual DOM and reconciliation — and why keys matter in a list.
Why they ask it: it's the core mental model of React. Getting keys right is a daily correctness issue, and candidates who use the array index as a key (then hit subtle bugs) reveal they don't understand what reconciliation is doing.
Strong sample answer"When state changes, React builds a new tree of elements in memory and diffs it against the previous one, then applies the minimal set of real DOM mutations — that diff is reconciliation, and it exists because touching the real DOM is expensive. Keys are how React matches elements across renders within a list: a stable, unique key tells React 'this is the same item, just moved or updated,' so it preserves state and DOM instead of tearing down and rebuilding. Using the array index as a key breaks this the moment the list reorders or you insert in the middle — React mismatches items, and you get bugs like a checkbox's checked state sticking to the wrong row. So I key by a stable id from the data, never the index unless the list is static and append-only."
10. What problem do the rules of hooks solve, and when do you actually need useMemo or useCallback?
Why they ask it: hooks are everywhere, and misuse is rampant — people either break the rules or wrap everything in useMemo as a reflex. They want to see you understand the mechanism and optimize deliberately, not cargo-cult.
"Hooks must be called in the same order on every render, which is why you can't call them conditionally or in loops — React tracks hook state positionally, so a changing call order would scramble which state belongs to which hook. As for memoization: I don't reach for useMemo or useCallback by default, because they aren't free — they cost memory and a dependency comparison. I use useMemo when a computation is genuinely expensive, and useCallback when I'm passing a function down to a memoized child that would otherwise re-render because the function identity changes each time, or when a function is a dependency of an effect. The honest rule is: measure first, memoize the specific hot spot, and don't pre-optimize cheap renders — the indirection often costs more than it saves."
11. How do you decide where state should live — local, lifted, context, or a store?
Why they ask it: state management is where frontend apps get messy, and this question separates developers who can architect from those who reach for a global store reflexively. It's especially weighted in senior loops.
Strong sample answer"I keep state as local as possible and only lift it when more than one component genuinely needs it. The progression I follow: local useState first; lift to the nearest common parent when siblings must share it; reach for context only for things that are truly app-wide and change rarely — theme, current user, locale — because context re-renders every consumer when it changes, so it's a poor fit for high-frequency state. For complex client state I'd use a dedicated store with selectors so components subscribe only to the slice they use. And critically, I separate server state from client state — data fetched from an API has its own caching, loading, and invalidation needs, so I use a data-fetching library for it rather than hand-rolling it into a global store. Most 'state management is hard' pain comes from conflating those two."
Performance & rendering questions
Frontend performance is increasingly a first-class hiring signal, because it maps directly to revenue and Core Web Vitals. Interviewers want to hear you measure before optimizing and know which lever to pull for which symptom — not a memorized list of tips.
12. A page feels slow to load and janky to interact with. How do you diagnose and fix it?
Why they ask it: it's the realistic version of a performance question — open-ended, no single answer. They want a measure-first method and familiarity with Core Web Vitals, not a guess.
Strong sample answer"I measure before I touch anything — I'd profile with the browser's performance panel and a Lighthouse run, and look at the Core Web Vitals to localize the problem. Slow loading usually means too much JavaScript or render-blocking resources, so I'd code-split and lazy-load below-the-fold routes, defer non-critical scripts, and right-size images with modern formats and responsive sizing. A poor LCP often points at the hero image or a slow server response. Janky interaction — a poor INP — usually means long tasks blocking the main thread, so I'd break up heavy work, debounce expensive handlers, and virtualize long lists so I'm not rendering thousands of DOM nodes. Layout shift (CLS) is almost always missing dimensions on images or late-injected content, fixed by reserving space. The discipline is the same as debugging: localize with evidence, fix the biggest contributor first, re-measure."
13. What's the difference between a reflow and a repaint, and why does it matter?
Why they ask it: it's a precise test of whether you understand the browser's render pipeline, which underlies most rendering-performance work. The strong signal is connecting it to a concrete optimization, like batching DOM reads and writes.
Strong sample answer"A repaint is the browser redrawing pixels when something purely visual changes — a color or a shadow — without affecting geometry. A reflow (layout) is more expensive: it's the browser recalculating the geometry of elements when something changes size or position, and it can cascade to the rest of the page. The trap is layout thrashing — interleaving DOM reads (like offsetHeight) and writes in a loop, which forces a synchronous reflow on every iteration because each read needs up-to-date layout. The fix is to batch all reads, then all writes. For animation, I prefer transform and opacity because they can be handled by the compositor and skip layout and paint entirely, which is why they stay smooth at 60fps while animating something like top or width stutters."
Behavioral & collaboration questions
Many strong coders are surprised that the behavioral round can sink an otherwise-passing frontend loop. It can. Frontend sits at the seam between design, product, and backend, so this round asks whether you can collaborate across that seam, own the user experience, and handle disagreement and deadline pressure like a senior professional. Answer with the STAR method — Situation, Task, Action, Result — keeping the situation brief and spending most of your words on what you specifically did. Use real, specific stories with numbers; vague answers read as inexperience.
14. Tell me about a time you disagreed with a designer or PM about how something should be built.
Why they ask it: frontend developers live at the intersection of design intent and technical reality, and how you navigate that tension predicts whether you'll be a partner or a roadblock. They're watching for someone who pushes back with evidence and a better option, then commits.
Strong sample answer (STAR)Situation: "A designer specced an autoplaying carousel as the hero of our landing page. Task: I owned the build, and I was concerned it would hurt both accessibility and performance — autoplay is a known accessibility issue, and the image set was heavy enough to wreck our LCP. Action: Instead of just refusing, I built a quick prototype both ways and measured: the carousel pushed LCP from 1.9s to over 4s and failed a keyboard pass. I showed the designer the numbers and the recording, and proposed a single strong hero image with the other content below — keeping the visual impact she wanted without the cost. Result: We shipped the static hero, LCP stayed under 2 seconds, and the page passed our accessibility checklist. The conversion rate actually came in higher than the carousel mockup tested. The lesson: bring a measured alternative, not just an objection — design and engineering align fast around evidence."
15. Tell me about a frontend performance or quality problem you owned end to end.
Why they ask it: it reveals whether you take responsibility for the user's actual experience or stop at "it works on my machine." Strong frontend developers treat performance and quality as theirs to own, not the next team's problem.
Strong sample answer (STAR)Situation: "Our dashboard had grown to where the main bundle was over 2MB and first load took eight-plus seconds on a mid-range phone; support tickets about 'the app is slow' were climbing. Task: No one owned performance, so I picked it up and set a budget. Action: I profiled the bundle, found two heavy dependencies pulling in everything when we used a sliver of each, and replaced them with lighter alternatives. I route-split so each view loaded only its own code, lazy-loaded the charting library that only one page needed, and virtualized a table that was rendering 5,000 rows at once. Then I added a CI check that fails the build if the bundle crosses the budget, so it couldn't quietly regress. Result: First load dropped from over eight seconds to about two and a half, the bundle shrank by roughly 60%, and the 'slow' tickets stopped. The guardrail mattered as much as the fix — it kept the win from eroding."
Don't walk into this loop alone.
Interview prep is the heart of Marqee's Executive service. A real strategist runs full mock interviews with you — a live UI-build round, JavaScript and React deep-dives, and behavioral — tears down your answers line by line, and preps you for the specific companies on your calendar, so you walk into the real thing rehearsed and calm.
See how the Executive prep works →How to prepare for a frontend developer interview
The candidates who do best aren't the ones who grind the most algorithm problems — they're the ones who practice the surfaces a frontend loop actually tests, and rehearse out loud. Here's a plan that scales from three weeks (experienced) to ten (career changers and bootcamp grads).
| Surface | What to do | How much |
|---|---|---|
| JavaScript fundamentals | Drill closures, this, the event loop, promises, and implement utilities (debounce, throttle, a small event emitter) from scratch — out loud, explaining each choice. | Daily, 30–45 min |
| Live UI building | Build real components in a browser sandbox under time — a modal, an accessible dropdown, a typeahead, a star rating — with keyboard support and clean CSS. This is the highest-leverage prep. | 3–4 builds/week |
| React internals | Be able to explain reconciliation, keys, the rules of hooks, when to memoize, and how you'd debug an unnecessary re-render — with mechanisms, not API recall. | 2–3 sessions |
| CSS, a11y & performance | Practice layout from a mockup, keyboard-and-screen-reader test your own builds, and learn the Core Web Vitals and the lever for each. | Ongoing |
| Behavioral stories | Write 5–7 STAR stories — a design disagreement, a perf win, a nasty cross-browser bug, an accessibility push, an ownership moment — and rehearse them aloud. | One pass, then refine |
Three principles separate effective prep from busywork. First, build, don't read — re-reading framework docs feels productive but trains the wrong skill; the interview makes you construct a working widget live, so that's what you should practice. Second, narrate everything, including your CSS and accessibility decisions, because the interviewer can only credit the reasoning they hear. Third, do mock interviews — nothing else surfaces the gap between "I can build this at my desk" and "I can build this while a stranger watches and pushes back." A solid résumé gets you the interview — see our frontend developer resume example for that — but rehearsed reps are what convert it into an offer.
Common mistakes & red flags
Interviewers compare notes against a rubric, and certain behaviors reliably sink otherwise-strong candidates. Most are avoidable once you know they're being watched.
- Reaching for a library the platform makes unnecessary. Pulling in a dependency to do what a native element, CSS, or a few lines of JavaScript already handle signals you don't know the platform well. Reach for the platform first.
- Treating accessibility as optional. Building a mouse-only widget, skipping focus management, or never mentioning the keyboard is a fast down-rank — especially at senior level, where a11y is expected to be a habit.
- Not knowing what the browser is doing. Being unable to explain the event loop, the render pipeline, or why a reflow is costly suggests you code by trial and error rather than understanding.
- Magic-number CSS. Styling with arbitrary pixel values, stacked
!important, and no system reads as someone who fights the cascade instead of working with it. - Ignoring different viewports. Building only for a desktop width and never checking mobile or a narrow window signals you don't think about real users on real devices.
- Cargo-culting React optimizations. Wrapping everything in
useMemo/useCallbackwithout being able to say why — or using the array index as a list key — reveals you don't understand the model underneath. - Building in silence. A correct component with no narration scores below an incomplete one with clear reasoning. The interviewer can only credit the thinking they hear.
- Vague behavioral answers. "We improved performance" with no specifics or numbers reads as either inexperience or invention. Use real stories with real metrics.
Questions to ask the interviewer
The "do you have any questions for me?" close is not a formality — it's still being scored, and it's your chance to show genuine craft curiosity and judgment. Skipping it, or asking only about perks, is a missed signal. Ask things that reveal how the team actually builds and ships UI. For a deeper menu, see our guide on questions to ask the interviewer; here are strong, role-specific ones for frontend developers:
- "How do design and engineering collaborate here — do you have a design system, and who owns it?"
- "How does the team think about accessibility — is it built into the definition of done, or handled separately?"
- "Do you have a performance budget, and how do you keep bundle size and Core Web Vitals from regressing?"
- "What does the frontend stack look like, and what's the biggest piece of tech debt you're carrying?"
- "How do you handle cross-browser and device testing in your workflow?"
- "What does the path from a component in a designer's file to production look like?"
- "What does a successful first 90 days in this role look like to you?"
Keep preparing
This page focuses on the frontend developer loop specifically. For the broader fundamentals that apply to any role, these free guides go deeper:
Frequently asked questions
A typical frontend loop has four to six rounds: a recruiter screen, a technical phone screen on JavaScript and DOM fundamentals, then an onsite that usually includes a UI build round (implement a component live in the browser), a JavaScript/algorithms round, an applied frontend round covering CSS, accessibility and performance, and a behavioral round. Increasingly there's a take-home or pairing session where you build a small app. Each round scores a different dimension — language fluency, UI craft, browser knowledge, and collaboration.
The recurring favorites are closures and scope, the difference between == and ===, how "this" is bound, the event loop and the difference between microtasks and macrotasks, promises versus async/await, and prototypal inheritance. Interviewers also love practical implementation tasks like writing a debounce or throttle function, because they combine closures, timers, and the event loop in one small, revealing problem.
Common React questions cover the reconciliation/virtual-DOM model and why keys matter, the rules of hooks and why they exist, the difference between useEffect and useMemo/useCallback, controlled versus uncontrolled inputs, how to lift state up versus reach for context, and how you'd diagnose and fix an unnecessary re-render. Senior loops add component architecture, data-fetching patterns, and how you'd structure a design system.
Increasingly central. Strong teams now expect frontend developers to reach for semantic HTML first, know the basics of WCAG (color contrast, focus management, keyboard operability), understand when and how to use ARIA, and be able to make a custom widget like a modal or dropdown keyboard- and screen-reader-accessible. Treating accessibility as an afterthought is a common down-rank, especially at senior level.
Common ones include: a time you disagreed with a designer or product manager, a performance or UX problem you diagnosed and fixed, how you handled cross-browser or device bugs, a time you pushed back on scope to protect accessibility or quality, and a project where you owned the frontend architecture. They test collaboration with design and backend, ownership of the user experience, and judgment under deadline pressure. Answer them with the STAR method and real specifics.
Three to six weeks of consistent practice is typical for working frontend developers; career changers and bootcamp grads often need six to ten. Spend the bulk of it on JavaScript fundamentals and live UI-building under time, add a focused pass on React internals, CSS layout, accessibility and performance, and rehearse five to seven behavioral stories out loud. Building small components from scratch in the browser is far more valuable than re-reading documentation.
The biggest red flags are reaching for a framework or library to solve something the platform already does, ignoring accessibility and semantics, being unable to explain what the browser is actually doing (the event loop, the render pipeline, reflow), styling with magic numbers and no system, never testing on different viewports, and treating performance as someone else's problem. Interviewers also down-rank candidates who can't explain why a React component re-rendered.
Stop applying. Start interviewing.
A real Marqee strategist finds the roles, tailors your materials, runs recruiter outreach and referral discovery, and submits on your behalf — and on Executive, runs the mock interviews that get you offer-ready. Become a marquee candidate instead of one of the pile.
See how it works →