Interview questionsUpdated 12 Oct 2026 · Team InterviewPlan

Frontend Developer Interview Questions and Answers

Frontend interviews test JavaScript fundamentals, layout skills, browser internals and how you build fast, accessible interfaces. Framework questions come later, but the core of most loops is still plain JavaScript and CSS. These questions reflect what frontend candidates face in 2026 at product companies, agencies and services firms.

What interviewers test in a frontend developer interview

Typical loops include a JavaScript fundamentals round, a live coding round building a small UI such as a modal, autocomplete or tabs, a framework round and sometimes a frontend system design round for senior roles.

Interviewers watch how you think about the user: loading states, error handling, keyboard navigation and mobile layouts. Working code that ignores these scores lower than slightly less polished code that handles them.

  • JavaScript: scope, closures, prototypes, async and the event loop
  • CSS: box model, specificity, Flexbox, Grid and responsive units
  • Browser: rendering pipeline, reflow and repaint, storage and caching
  • Quality: accessibility, performance, security and testing
  • Architecture: component design, state management and build tooling

Technical topics to revise

Build three or four small components from scratch without a framework, then rebuild one in React or your framework of choice. This prepares you for both fundamentals and framework questions.

  • Closures, this, call, apply and bind, and arrow functions
  • Promises, async and await, microtasks versus macrotasks
  • Debounce and throttle implementations
  • Flexbox and Grid layouts, media and container queries
  • Semantic HTML, ARIA roles, focus management and WCAG basics
  • Core Web Vitals: LCP, INP and CLS, and how to improve each
  • Vite, webpack, code splitting, tree shaking and lazy loading
  • XSS, CSRF, Content Security Policy and CORS

How to structure your answers

For concept questions, explain with a tiny code example and a real bug you have seen. For live coding, confirm requirements, build a working version first, then improve accessibility, edge cases and styling as time allows.

For project questions, mention measurable results such as page load improvements, Lighthouse score changes or reduced bundle size.

How InterviewPlan AI helps you prepare

Practise frontend mock interviews with JavaScript, CSS and browser questions and get feedback on clarity. Use coding help to review practice components, and Resume AI to quantify performance and accessibility work.

Interview Copilot provides live speaker-labelled transcription and resume-grounded answer drafts in under a second during calls on Zoom, Teams, Meet and Webex. Follow each employer's interview rules. The free plan includes 5 live minutes and 100 AI credits with no card.

Questions and model answers

9 questions you are likely to hear.

  1. Explain the JavaScript event loop.

    Why they ask: This is the foundation for understanding async behaviour and many subtle bugs.

    Sample answer: JavaScript runs on a single thread with a call stack. When I call async APIs like setTimeout or fetch, the browser handles them outside the stack, and their callbacks are queued when ready. The event loop runs each task to completion, then drains the microtask queue, which holds promise callbacks and queueMicrotask, before rendering and taking the next task. So a resolved promise callback runs before a setTimeout of zero. I once debugged a UI freeze caused by a long synchronous loop processing 50,000 rows; splitting the work into chunks with requestIdleCallback kept the page responsive.

  2. What is a closure? Give a practical example.

    Why they ask: Closures are central to JavaScript patterns and frequently asked.

    Sample answer: A closure is a function that remembers variables from the scope where it was created, even after that outer function has returned. A practical example is a debounce function: it keeps a timer variable in its closure and returns a new function that clears and resets that timer on each call. I used debounce on a search input so the API is called only after the user stops typing for 300 milliseconds, which cut search requests by about 80 percent. Closures can also cause memory leaks if they hold references to large objects or DOM nodes that should be released.

  3. How does the browser render a page, and what causes layout thrashing?

    Why they ask: This tests browser internals and performance awareness.

    Sample answer: The browser parses HTML into the DOM and CSS into the CSSOM, combines them into a render tree, calculates layout, paints pixels and composites layers. Layout thrashing happens when code repeatedly writes to the DOM and then reads layout properties like offsetHeight in a loop, forcing the browser to recalculate layout many times per frame. The fix is to batch reads first and then writes, or use requestAnimationFrame. For animations I prefer transform and opacity, which can be handled by the compositor without layout. Fixing this on a scrolling table removed visible jank on low-end Android phones.

  4. How do you make a custom dropdown accessible?

    Why they ask: Accessibility is now a standard expectation, and custom widgets are where most failures happen.

    Sample answer: First I check whether a native select works, because it is accessible by default. If a custom dropdown is needed, I use a button with aria-haspopup and aria-expanded, and a list with role listbox and options with role option and aria-selected. Keyboard support must include arrow keys, Enter, Escape and Home and End, and focus must return to the button when the menu closes. I test with a screen reader such as NVDA or VoiceOver and with keyboard only. On a banking portal, fixing these patterns helped us pass an accessibility audit that had blocked release.

  5. What are Core Web Vitals, and how have you improved them?

    Why they ask: Performance directly affects business metrics, so interviewers want hands-on experience.

    Sample answer: Core Web Vitals are Largest Contentful Paint for loading, Interaction to Next Paint for responsiveness and Cumulative Layout Shift for visual stability. On an ecommerce site, LCP was around 4 seconds because the hero image was large and loaded late. I served responsive WebP images, preloaded the hero, and inlined critical CSS, bringing LCP under 2.5 seconds on mobile. CLS came from ads and images without dimensions, so I reserved space with aspect-ratio. INP improved after we split a heavy third-party script and deferred it. I track field data in Search Console, not only Lighthouse.

  6. Explain CSS specificity and how you avoid specificity wars.

    Why they ask: Interviewers check CSS fundamentals and maintainable styling practices.

    Sample answer: Specificity decides which rule wins when several match an element. Inline styles beat IDs, IDs beat classes, attributes and pseudo-classes, and those beat element selectors; !important overrides normal rules. Specificity wars happen when teams keep adding more specific selectors or !important to override each other. I avoid this by using single-class selectors with a naming convention like BEM, CSS modules or utility classes, and cascade layers with @layer to control order. In one legacy app we had over 200 !important declarations; moving component styles into layers let us remove most of them.

  7. How would you prevent XSS in a frontend application?

    Why they ask: Security awareness is expected from every frontend developer.

    Sample answer: I never insert untrusted data as HTML. I render text with textContent or the framework's default escaping, and avoid innerHTML or dangerouslySetInnerHTML unless the content is sanitised with a library like DOMPurify. I validate URLs before using them in href to block javascript: links. I also rely on a Content Security Policy that restricts script sources and disallows inline scripts where possible, and I keep auth tokens in httpOnly cookies rather than localStorage. During a review, I found a rich text comment field rendering raw HTML and fixed it with sanitisation before it reached production.

  8. Build an autocomplete search box. What would you consider?

    Why they ask: This common live coding task checks practical UI engineering.

    Sample answer: I would debounce input to around 300 milliseconds, cancel stale requests with AbortController so older responses do not overwrite newer ones, and cache recent queries. The UI needs loading, empty and error states. For accessibility I would use the combobox pattern with aria-expanded, aria-activedescendant and full keyboard navigation. I would highlight the matched text safely without injecting HTML, and limit results to a manageable number. On mobile I would make sure the list does not get hidden behind the keyboard. I would build a working version first, then add these improvements in order of user impact.

  9. Tell me about a frontend performance problem you solved.

    Why they ask: This shows ownership and measurable impact.

    Sample answer: Our analytics dashboard took about 9 seconds to become interactive because the main bundle was over 2 MB. Using the bundle analyser, I found a full charting library, a date library with all locales and several unused UI components. I code-split each dashboard route, lazy-loaded charts, replaced the date library with a smaller one and removed dead code. The main bundle dropped to around 600 KB, and time to interactive fell to roughly 3 seconds on a mid-range phone. I added a bundle size check to CI so regressions are caught in pull requests.

FAQ

Questions people ask about frontend developer.

Do frontend interviews focus on React or JavaScript?

Both, but JavaScript fundamentals usually come first. Many candidates fail on closures, async behaviour or this binding even when they know React well. Prepare plain JavaScript and CSS thoroughly, then your framework.

What is frontend system design?

It is a senior-level round where you design something like a news feed or chat widget: components, state management, data fetching, caching, performance, accessibility and error handling. Practise by sketching architecture for apps you use daily.

Should I prepare TypeScript for frontend interviews?

Yes. Most frontend teams in 2026 use TypeScript. Know interfaces versus types, generics, union types, narrowing and utility types like Partial and Pick, and be ready to type component props and API responses.

Can InterviewPlan AI help with live coding rounds?

Mock interviews and coding help, both using AI credits, let you practise beforehand. Interview Copilot runs as a desktop app during live calls. Check the employer's rules for live coding and follow them.

P.S.

Reading helps. Practising out loud helps more.

Start free with 5 live minutes and 100 AI credits for Resume AI, Job Search, Auto-Apply, mock interviews and Behavioral Coach.