See what's new

Testlify
HR & recruitment
Last updated on: 9 November 202621 min read

40 frontend developer interview questions to ask in 2026

40 frontend developer interview questions for hiring teams, grouped by skill and level, with strong answers, red flags and a scorecard.

40 frontend developer interview questions to ask in 2026

Frontend developer interview questions help a hiring team check whether a candidate can build interfaces that work for real users: correct HTML, maintainable CSS, sound JavaScript, a framework such as React, and the judgment to keep a page fast, accessible and secure. The 40 questions below are written for interviewers, so each one tells you what a strong answer includes and what should worry you.

TL;DR / Key Takeaways

  • The best frontend developer interview questions test six areas: HTML and accessibility, CSS, JavaScript, a framework such as React, performance and security, and teamwork.
  • Ask 8 to 12 questions per round, not all 40. Pick the ones that match the job description and the level you are hiring for.
  • Score trade-offs above definitions. A strong candidate explains when not to use a tool, not just what it does.
  • TypeScript, Core Web Vitals and WCAG 2.2 belong in a 2026 interview. TypeScript is used by 48.8% of professional developers in the Stack Overflow 2025 survey.
  • Juniors should be tested on fundamentals and layout, mid-level developers on state, testing and debugging, and seniors on architecture and decisions.
  • Use a short skills test before the first interview and the same 1 to 4 scorecard for every interviewer, so the debrief compares evidence instead of impressions.
Summarise this post with:ChatGPTGeminiClaudeGrokPerplexity

What should frontend developer interview questions test?

Frontend developer interview questions should test six skill areas: semantic HTML and accessibility, CSS layout, JavaScript fundamentals, a framework such as React, performance and security, and how the candidate works with designers and backend engineers. Strong candidates explain trade-offs in each area, not only definitions.

Six skill areas frontend developer interview questions should test, from HTML and accessibility to teamwork

The tools matter too. The Stack Overflow Developer Survey 2025 found that 66% of all respondents use JavaScript, 61.9% use HTML and CSS and 43.6% use TypeScript. React is the most used web framework at 44.7%, ahead of Next.js (20.8%), Angular (18.2%) and Vue.js (17.6%). So unless your stack says otherwise, most of your framework questions should be about React.

In my work with hiring teams, the most common mistake I have seen is a loop that asks only trivia. Definitions are easy to memorise and easy to look up. The questions below ask the candidate to explain, compare and decide, which is much harder to fake.

Pro tip: Before the interview, mark the 3 or 4 skills the job description cannot do without. Spend most of the time there and skip the rest. The front end developer job description template is a good place to start that list.
Build your dream team — Book a product demo

Which HTML and accessibility questions should you ask?

HTML and accessibility questions show whether a candidate builds pages that every user, browser and screen reader can use. Good candidates reach for the right element first and add ARIA only when no native element fits. These five questions take about 10 minutes and quickly separate careful developers from div-only ones.

1. What is semantic HTML, and why does it matter?

Strong answer: Uses elements that describe their meaning, such as header, nav, main, article, button and label, so screen readers, search engines and other developers understand the page. Mentions that a real button is focusable and keyboard-ready by default, while a clickable div is not.

Red flag: Treats semantics as only an SEO concern, or says "a div with a class works the same".

2. What is the difference between block, inline and inline-block elements?

Strong answer: Block elements start on a new line and take the full width (div, p, section). Inline elements flow with text and ignore width and height (span, a, strong). Inline-block flows inline but accepts width, height and vertical padding.

Red flag: Cannot say which category a common element belongs to.

3. How do you make a custom component, such as a dropdown, accessible?

Strong answer: Starts with a native element if one exists (select, details, dialog). If not, adds the right role, keyboard support (Tab, Enter, Escape, arrow keys), visible focus, and ARIA states such as aria-expanded. Tests with a keyboard and a screen reader.

Red flag: Adds aria attributes everywhere without keyboard support, which can make the component worse than plain HTML.

4. What does WCAG 2.2 ask of a frontend developer day to day?

Strong answer: Names practical checks from the W3C WCAG 2.2 guidelines: text alternatives for images, enough color contrast (4.5:1 for normal text at level AA), labels on form fields, full keyboard use, visible focus, and target sizes large enough to tap. Bonus if the candidate mentions running an automated checker and then testing by hand.

Red flag: Says accessibility is the designer's job, or answers a contrast failure with "change the color" and no idea of the threshold.

5. What are data attributes, and when would you use them?

Strong answer: Custom data-* attributes store small pieces of data on an element, read in JavaScript through dataset or used as CSS hooks. Good for test ids and simple state, not for large data or anything sensitive.

Red flag: Stores user data or tokens in the markup.

Which CSS and layout questions should you ask?

CSS and layout questions reveal whether a candidate can build layouts that hold up on every screen without fighting the cascade. Look for a clear mental model of the box model, specificity and modern layout tools, and for answers that mention responsive and maintainable code, not just making one screen look right.

6. Explain the CSS box model.

Strong answer: Every element is content, padding, border and margin. Explains box-sizing: border-box and why most teams set it globally, because width then includes padding and border.

Red flag: Confuses padding and margin, or has never heard of box-sizing.

7. When do you use Flexbox and when do you use Grid?

Strong answer: Flexbox lays out items in one direction (a row or a column), so it suits navigation bars and button groups. Grid controls rows and columns together, so it suits page layouts and card grids. Often uses both on one page.

Red flag: Uses one for everything, or still reaches for floats to build layouts.

8. How does CSS specificity work?

Strong answer: Inline styles beat ids, ids beat classes, attributes and pseudo-classes, and those beat element selectors. Later rules win when specificity is equal. Mentions cascade layers or low-specificity naming (such as BEM or utility classes) as ways to keep it under control.

Red flag: Solves every conflict with !important.

9. What is the difference between em, rem, px and viewport units?

Strong answer: px is fixed, em is relative to the parent's font size, rem to the root font size, and vw or vh to the viewport. Prefers rem for type and spacing so the page respects the user's browser font setting.

Red flag: Uses only px and cannot explain why that can hurt users who zoom.

10. How do you build a responsive layout?

Strong answer: Starts mobile first, uses fluid grids, flexible images and media queries, and mentions container queries for components that should adapt to their own space rather than the screen. Tests on real devices.

Red flag: Builds desktop first and "fixes mobile at the end".

11. What are pseudo-classes and pseudo-elements?

Strong answer: Pseudo-classes style a state (:hover, :focus-visible, :nth-child). Pseudo-elements style a part of an element (::before, ::after, ::placeholder). Mentions :focus-visible for keyboard users.

Red flag: Removes focus outlines with outline: none and no replacement.

Which JavaScript questions should you ask?

JavaScript questions test the fundamentals every framework is built on: scope, closures, the event loop and the DOM. Candidates who understand these debug faster and write fewer surprising bugs. Ask for a small example with each answer, because a working example is far harder to memorise than a definition.

JavaScript developer interview questions go deeper if the role is JavaScript-heavy.

12. What is the difference between var, let and const?

Strong answer: var is function-scoped and hoisted with undefined. let and const are block-scoped and sit in the temporal dead zone until declared. const prevents reassignment, not mutation of an object.

Red flag: Says const makes an object immutable.

13. What is a closure, and where have you used one?

Strong answer: A closure is a function that keeps access to variables from the scope where it was created, even after that scope has finished. Gives a real use: a counter, a debounce function, or a React hook that captures state.

Red flag: Gives the textbook definition but no example.

14. Explain the event loop.

Strong answer: JavaScript runs one task at a time on the call stack. Async work (timers, network calls) is handed to the browser, and callbacks return through the task queue. Promises use the microtask queue, which runs before the next task, so a resolved promise logs before a setTimeout of 0.

Red flag: Believes setTimeout of 0 runs immediately.

15. How do promises and async/await work, and how do you handle errors?

Strong answer: A promise represents a future value that is pending, fulfilled or rejected. async/await is cleaner syntax over promises. Errors are caught with try/catch or .catch(). Knows Promise.all fails fast while Promise.allSettled waits for every result.

Red flag: Forgets error handling entirely.

16. How does the this keyword work?

Strong answer: this depends on how a function is called: the object before the dot, the new instance with new, undefined in strict-mode plain calls, and whatever call, apply or bind sets. Arrow functions take this from the surrounding scope.

Red flag: Says this always points to the function itself.

17. What is event delegation, and why use it?

Strong answer: Attaches one listener to a parent and uses event.target to handle events from many children. Uses less memory and works for elements added later. Knows how bubbling makes it possible.

Red flag: Adds a listener to each of 1,000 list items.

18. What is the difference between == and ===?

Strong answer: == converts types before comparing, so 0 == "" is true. === compares value and type with no conversion. Uses === by default.

Red flag: Cannot give one surprising == result.

Which React and framework questions should you ask?

React and framework questions show whether a candidate understands rendering and state, not just component syntax. Most frontend roles in 2026 use React, so these questions assume it. Swap in Angular or Vue questions if that is your stack, and focus on why the app re-renders.

For a full React round, use these React developer interview questions. For an Angular stack, see the Angular developer interview questions.

19. What causes a React component to re-render?

Strong answer: A change in its own state, a re-render of its parent, or a change in a context it reads. Explains that React.memo, useMemo and useCallback can skip work but only help when the props are actually stable.

Red flag: Says "only when props or state change" and misses parent re-renders.

20. When would you use useEffect, and when should you avoid it?

Strong answer: useEffect syncs a component with something outside React, such as a subscription or a non-React widget. Avoids it for values that can be calculated during render and for data that a framework loader or query library already fetches. Knows the dependency array and cleanup function.

Red flag: Uses useEffect to copy props into state.

21. How do you decide where state should live?

Strong answer: Keeps state as close as possible to where it is used, lifts it up when siblings share it, uses context for app-wide values such as theme or user, and a server-state library for API data. Reaches for a global store only when the app needs it.

Red flag: Answers every state question with "put it in Redux".

22. What are React Server Components, and what problem do they solve?

Strong answer: Components that render on the server and send no JavaScript for themselves to the browser, so pages load less code. Interactive parts become client components. Can describe the trade-off: less JavaScript, but a clear line between server and client code.

Red flag: Marks every component as a client component "because it is easier".

23. Why does React need keys in lists?

Strong answer: Keys tell React which item is which between renders, so it can keep state and DOM nodes attached to the right item. Uses a stable id, not the array index, when items can move or be deleted.

Red flag: Uses Math.random() as a key.

Which TypeScript, testing and tooling questions should you ask?

TypeScript, testing and tooling questions check whether a candidate can work in a team codebase, not just a personal project. These are the areas older question lists skip most often. They also predict how much review and rework a new hire will need in the first months.

24. What is the difference between an interface and a type in TypeScript?

Strong answer: Both describe object shapes. Interfaces can be extended and merged, and suit public object contracts. Type aliases can also describe unions, tuples and mapped types. Picks one convention and stays consistent.

Red flag: Uses any to silence every compiler error.

25. How do you use generics?

Strong answer: Generics let a function or component work with many types while keeping type safety, for example a typed fetch helper or a list component whose items keep their type. Can write a short example out loud.

Red flag: Has never written a generic, only used them in library code.

26. How do you test frontend code?

Strong answer: Unit tests for logic, component tests that interact like a user (for example with Testing Library), and a few browser tests (Playwright or Cypress) for critical flows such as sign-up or checkout. Tests behavior, not implementation details.

Red flag: Says testing is the QA team's job, or tests only snapshots.

27. What does a bundler do, and how do you keep bundles small?

Strong answer: A bundler such as Vite or webpack resolves imports, compiles TypeScript and JSX, and produces optimized files. Keeps bundles small with code splitting, lazy loading routes, tree shaking and checking the size of new dependencies before adding them.

Red flag: Adds a large library to format one date.

Which performance and security questions should you ask?

Performance and security questions test whether a candidate thinks about real users on slow phones and about attackers. Strong answers start by measuring the problem before fixing it. These questions matter most for e-commerce, fintech and SaaS products, where a slow or unsafe page costs revenue and trust.

28. What are Core Web Vitals, and how would you improve a poor score?

Strong answer: Names the three metrics: Largest Contentful Paint for loading, Interaction to Next Paint for responsiveness and Cumulative Layout Shift for visual stability. For a slow Largest Contentful Paint, first finds which element is the LCP element, then fixes that: preload the hero image, serve the right size, cut render-blocking CSS and JavaScript.

Red flag: Says "lazy-load all images" for every LCP problem, which can slow down the hero image.

29. What is the critical rendering path?

Strong answer: The browser parses HTML into the DOM and CSS into the CSSOM, combines them into a render tree, then lays out and paints. Blocking CSS and scripts delay the first paint, so critical CSS goes early and scripts use defer or async.

Red flag: Cannot say why a script in the head without defer slows the page.

30. How do you prevent cross-site scripting (XSS) in a frontend app?

Strong answer: Never inserts untrusted input as raw HTML. Relies on the framework's escaping, avoids dangerouslySetInnerHTML or innerHTML unless the content is sanitized, and supports a Content Security Policy. The OWASP guidance on XSS is the usual reference.

Red flag: Believes React makes XSS impossible in every case.

31. What is CORS, and why does the browser block some requests?

Strong answer: The browser's same-origin policy blocks reading responses from another origin unless the server allows it with CORS headers. Preflight requests check permission for non-simple requests. Knows the fix belongs on the server, not in a browser extension.

Red flag: Suggests turning off CORS in the browser to fix it.

Which code-based frontend developer interview questions work best?

Code-based frontend developer interview questions work best when they are small, realistic and close to the job: build a component, fix a bug, or write a utility the team really uses. Give 20 to 30 minutes per task and ask the candidate to talk through decisions while coding.

Frontend developer interview loop from skills test and tech screen to live coding, system design and behavioral round

32. Write a debounce function.

Strong answer: Returns a function that waits until calls stop for a set delay before running, using clearTimeout and setTimeout inside a closure. Explains where it helps, such as a search box that should not call the API on every keystroke.

What to watch: Whether the candidate keeps the right arguments and this, and can explain debounce versus throttle.

33. Build a counter component with increment, decrement and reset.

Strong answer: Uses useState, a functional update such as setCount(c => c + 1), real button elements with clear labels, and stops the count from going below zero if asked.

What to watch: Accessible buttons, clean state updates, and whether the candidate asks about requirements before coding.

34. Fetch a list from an API and show loading, error and empty states.

Strong answer: Uses fetch with async/await, checks response.ok, shows a loading state, an error message and an empty state, and cancels the request (AbortController) if the component unmounts.

What to watch: Error handling. Many candidates only code the happy path.

35. Center an element horizontally and vertically, two ways.

Strong answer: Flexbox with justify-content and align-items set to center on the parent, and Grid with place-items: center. Bonus for knowing when absolute positioning with translate is still needed.

What to watch: Speed and confidence. This should take a mid-level developer under two minutes.

Key takeaway: A short, realistic task tells you more than ten trivia questions. Score the candidate's reasoning and edge cases, not only whether the code runs.

Which behavioral questions reveal how a frontend developer works?

Behavioral questions reveal how a frontend developer works with designers, product managers and backend engineers, and how they handle pressure. Ask for a specific past example, then follow up on what the candidate did personally and what they would change next time.

36. Tell me about a time a design was hard to build as drawn. What did you do?

Look for: Raised the issue early, offered options, and agreed on a solution with the designer instead of quietly changing the design.

37. Describe the hardest bug you fixed in the last year.

Look for: A clear method: reproduce, narrow down, use dev tools or logs, fix the cause, and add a test so it cannot come back.

38. Tell me about a time you made a page faster or more accessible.

Look for: A measured before and after, such as a better Lighthouse or Core Web Vitals score, or a screen reader issue found and fixed.

39. How do you handle a code review comment you disagree with?

Look for: Asks questions, explains reasoning with evidence, and accepts the team's decision once it is made.

40. How do you use AI coding tools in your work?

Look for: Uses them for boilerplate, tests or exploration, and checks every suggestion for correctness, accessibility and security. Names a time an AI suggestion was wrong and how they caught it.

How do frontend developer interview questions change by seniority?

Frontend developer interview questions should get broader and more open as seniority rises. Juniors are tested on fundamentals and simple layouts, mid-level developers on state, testing and debugging, and seniors on architecture, trade-offs and influence on the team. The same question can be scored differently at each level.

Level

Focus of the questions

Example questions from this list

A strong answer shows

Junior (0 to 2 years)

HTML, CSS, core JavaScript

1, 6, 7, 12, 18, 35

Correct basics, clean simple code, willingness to learn

Mid-level (2 to 5 years)

Framework depth, testing, debugging

13, 14, 19, 20, 26, 34

Explains why, not just how; handles errors and edge cases

Senior (5+ years)

Architecture, performance, security, team impact

21, 22, 27, 28, 30, 39

Trade-offs, measuring before optimizing, raising the team's bar

Lead or staff

Platform choices and standards

21, 24, 27, plus a system design round

Decisions that hold up for years and across teams

For senior roles, add a frontend system design round: ask the candidate to design an autocomplete, an image gallery or a news feed, and score requirements, component structure, data flow and trade-offs.

How should you structure and score a frontend developer interview?

A frontend developer interview works best as a short loop: a skills test, a technical screen with topic questions, a live coding task, a system design round for mid-level and senior roles, and a behavioral round. Every interviewer scores the same rubric before the debrief, so decisions rest on evidence.

  1. Skills test: Screen applicants on HTML, CSS, JavaScript and your framework before any interviewer time is spent.
  2. Technical screen: Ask 8 to 12 questions from this list that match the job, in 30 to 45 minutes.
  3. Live coding: Give one realistic task from the code-based section and let the candidate talk through it.
  4. System design: For mid-level and senior candidates, design a component or feature together.
  5. Behavioral round and debrief: Use the behavioral questions, then compare written scores before anyone shares an opinion.
Frontend developer interview scorecard scale from 1 not shown to 4 strong

Score each answer from 1 to 4: 1 for not shown, 2 for partial, 3 for a solid answer with a working example, and 4 for a strong answer that explains trade-offs. A shared interview scorecard keeps interviewers consistent, and structured interviews make candidates easier to compare fairly.

Across the teams I talk to, the loops that hire well keep the same questions for every candidate at a level and write the evidence down during the interview, not after.

What red flags should interviewers watch for?

Red flags in a frontend developer interview are habits that cost the team time later: memorised answers with no example, fixes without measurement, and no thought for users who rely on a keyboard or a slow phone. One red flag is a reason to probe further, not an automatic rejection.

  • Trivia without examples: Knows every definition but cannot show where they used one.
  • !important and inline styles: Fights the cascade instead of understanding it.
  • No error handling: Codes only the happy path in every task.
  • Accessibility as an afterthought: Removes focus outlines, uses divs as buttons, ignores contrast.
  • Optimizing without measuring: Adds useMemo everywhere or lazy-loads everything "for speed".
  • One tool for every problem: Redux for all state, one library for every layout.
  • Blind trust in AI output: Pastes generated code without reading or testing it.

For more ways to filter candidates before the interview stage, see how to screen candidates for frontend developer roles.

How can you screen frontend developers before the interview?

Hiring teams can screen frontend developers before the interview with a skills test that checks HTML, CSS, JavaScript and framework knowledge, so interviewers only meet candidates who already pass the basics. Testlify's front end developer test does this in one assessment.

With Testlify you can combine that test with coding tests in a live IDE, a TypeScript test and custom questions, all scored automatically. More than 20 proctoring checks, including copy and paste tracking and AI assistance detection, help keep the results honest, and results sync to 100+ ATS integrations.

Testlify is credit-based, so you pay only when a candidate starts an assessment, and there is a 7-day free trial with no credit card. For the full hiring process, see the hiring guide for front end developers.

Frequently asked questions (FAQ)

Get started.

Hire on proof, not resumes.

Run your first skills-based assessment free — no credit card required.

We use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking "Accept All", you consent to our use of cookies.