Frontend developer interview questions and how to answer them
Frontend developer interviews cover JavaScript fundamentals, HTML and CSS, one framework in depth (most often React), browser performance, accessibility, and a practical coding task such as building a small component. Senior roles add frontend system design. Interviewers care less about trivia than about whether you can explain why the browser behaves as it does and build an interface that works for every user.
By Evin JohnPublished 5 min read
What the rounds look like
- ScreenA conversation about your projects plus a handful of fundamentals questions.
- CodingEither a JavaScript problem, or a small user interface built live in a sandbox.
- Framework and architectureA deeper discussion of React, Vue or Angular and how you structure a larger application.
- System design, for senior rolesDesign a news feed, a chat client or an image gallery from the browser's point of view.
- BehavioralWorking with designers and backend engineers, handling disagreement, and owning quality.
JavaScript questions
| Question | What a strong answer includes |
|---|---|
| What is a closure? | A function that keeps access to variables from the scope where it was created. Give a use: a counter, a memoized function or a private variable |
| Explain the event loop. | The call stack, the task queue and the microtask queue. Promise callbacks run before the next timer callback |
| What is the difference between == and ===? | === compares without type coercion. Mention a surprising coercion and say you default to === |
How does this work? | It depends on how a function is called. Arrow functions take this from the enclosing scope |
| var, let and const? | Function scope versus block scope, hoisting, and the temporal dead zone |
| What is event delegation? | One listener on a parent handles events from children through bubbling. Useful for long or changing lists |
| Implement debounce. | A timer reset on each call, with the latest arguments passed through. Explain how throttle differs |
| Promise.all versus Promise.allSettled? | all rejects on the first failure, allSettled waits for every result |
A frequent exercise is predicting the output order of a snippet that mixes console.log, setTimeout and a resolved promise. Work through it by naming which queue each callback enters. Getting the answer right matters less than showing the model in your head.
HTML and CSS questions
- Explain the box model. Content, padding, border and margin, and how
box-sizing: border-boxchanges width calculations. - Flexbox or grid? Flexbox for laying out items along one axis, grid for rows and columns together. Many layouts use both.
- How does specificity work? Inline styles, then IDs, then classes and attributes, then elements, with source order as the tie-breaker.
- How do you center an element? Show a flexbox or grid solution and say when each fits.
- How do display: none and visibility: hidden differ? The first removes the element from layout, the second keeps its space.
- Why use semantic HTML? Elements such as
button,navandmaincarry meaning for assistive technology and search engines, and come with keyboard behavior built in. - How do you make a layout responsive? Fluid units, media or container queries, and images that adapt to the viewport.
React and framework questions
| Question | The point |
|---|---|
| What causes a component to re-render? | State changes, parent re-renders and context changes. Re-rendering is usually cheap, so measure before optimizing |
| Why do list items need keys? | Keys let React match items between renders. Using the array index breaks when items are reordered or removed |
| When does an effect run, and what is cleanup for? | After render, when dependencies change. Cleanup removes subscriptions and timers to avoid leaks and stale updates |
| Where should state live? | As close as possible to where it is used, lifted only when siblings need it. Server data belongs in a data-fetching layer |
| Controlled or uncontrolled inputs? | Controlled inputs keep the value in state, which helps validation. Uncontrolled inputs leave it in the DOM |
| When would you use memoization? | After profiling shows an expensive render or calculation. Applied everywhere, it adds complexity without benefit |
| Server rendering versus client rendering? | Server rendering sends HTML sooner and helps search engines. It adds hydration cost and server complexity |
If your experience is with Vue, Angular or Svelte, the same ideas apply under different names: reactivity, component lifecycle, change detection and state management. Interviewers generally accept answers in the framework you know, as long as you can explain the concept underneath.
Performance and accessibility
- How would you speed up a slow page? Measure first with browser developer tools. Then look at bundle size, code splitting, image formats and sizing, caching, and render-blocking resources.
- What are Core Web Vitals? Metrics for loading speed, responsiveness to input, and visual stability. Know one cause and one fix for each.
- How do you render a list of 10,000 rows? Virtualization, so only visible rows are in the DOM, with pagination or infinite loading for the data.
- How do you make a modal accessible? Move focus into it, trap focus while it is open, close on Escape, return focus on close, and label it for screen readers.
- How do you test with a keyboard and a screen reader? Tab through every control, check the visible focus state, and listen to how the page is announced.
The practical coding round
Common builds include an autocomplete search box, a tabs component, a star rating, a to-do list with filters, an image carousel, and a table with sorting. The interviewer watches your order of work as much as the result.
- Ask about requirementsData source, empty and error states, keyboard support, and mobile behavior. Two minutes here saves ten later.
- Get a plain version workingRender static data first. Then add state and events.
- Handle the awkward casesLoading, errors, no results, and fast typing that returns responses out of order.
- Add accessibilityCorrect elements, labels and keyboard handling. Many candidates skip this, so doing it stands out.
- Say what you would do nextTests, debouncing, caching and styling you did not have time for.
Frontend system design
For a prompt such as "design a chat application's web client", cover the component tree, where state lives, how data arrives (polling, server-sent events or WebSockets), pagination of history, optimistic updates when sending, offline behavior and error recovery. Sketch the API you need from the backend. The general method is in the system design interview framework.
Preparing efficiently
Build three small components from scratch without a library, timed at 40 minutes each. Then explain ten JavaScript concepts aloud, as if to a colleague. Explaining is where gaps show. A mock interview with a friend is the best check. If you use Natively for practice, its coding interview assistant can read a problem from a screenshot of your editor and talk through an approach, and the session transcript stays on your computer for review.
Questions people ask
What is asked in a frontend developer interview?
JavaScript fundamentals such as closures and the event loop, HTML and CSS layout, one framework in depth, performance, accessibility, and a practical task such as building an autocomplete or a modal.
How do I prepare for a frontend coding round?
Build small components from scratch under a time limit: autocomplete, tabs, a sortable table. Clarify requirements first, get a plain version working, then handle loading, errors and keyboard use.
Do frontend interviews include system design?
Senior roles usually do. You design the browser side of something like a chat client or a feed: components, state, data fetching, pagination, optimistic updates and offline behavior.
Which React questions come up most?
What causes re-renders, why list items need keys, how effects and cleanup work, where state should live, controlled inputs, and when memoization is worth it.
Where to go next
Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.
Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.
