Frontend Development Interview Questions & Answers
All 200 unique questions in one place — 60 easy, 95 medium, 45 hard — grouped by topic.
Practise by topic
Practise the way your interview works
How does destructuring with default values work?
Show answer
Explain optional chaining and the nullish coalescing operator.
Show answer
When should you use Map and Set instead of plain objects and arrays?
Show answer
What are pure functions and why does immutability matter in frontend code?
Show answer
What are higher-order functions and currying?
Show answer
Flatten a deeply nested array without using Array.prototype.flat.
Show answer
Predict the output order of synchronous code, promises and setTimeout.
Show answer
Editing one item in a copied list also changes the original list. Why?
Show answer
Why do you want to build a career in frontend development?
Show answer
Compare Promise.all, Promise.allSettled, Promise.race and Promise.any.
Show answer
Why does await inside forEach not wait for each item?
Show answer
What are tagged template literals?
Show answer
How do private class fields and getters work in modern JavaScript?
Show answer
Implement a throttle function.
Show answer
Write a fetch wrapper that retries with exponential backoff.
Show answer
Cancel an older search request when the user types again using AbortController.
Show answer
Search results sometimes show data for an older query. What is happening?
Show answer
Users in India see order dates shifted by a day. What is the likely bug?
Show answer
Errors from failed promises are silently disappearing in production. How do you catch them?
Show answer
How would you explain a difficult JavaScript concept to a junior teammate?
Show answer
What are WeakMap and WeakRef, and when are they useful?
Show answer
What are Proxy and Reflect used for?
Show answer
Write a polyfill for Promise.all.
Show answer
Parsing a 30 MB JSON response freezes the page for seconds. How do you fix it?
Show answer
What is TypeScript and why do teams adopt it?
Show answer
What is the difference between type and interface in TypeScript?
Show answer
What are union and intersection types?
Show answer
Explain the utility types Partial, Pick, Omit and Record.
Show answer
How would you learn TypeScript quickly if your new project required it?
Show answer
Explain any, unknown and never.
Show answer
How does type narrowing work in TypeScript?
Show answer
What are generics and why are they useful?
Show answer
Should you use enums or string literal unions?
Show answer
Which tsconfig options are important for a strict codebase?
Show answer
What are declaration files (.d.ts) and when do you write them?
Show answer
Write a type-safe getProperty function using generics and keyof.
Show answer
Model API request state with a discriminated union.
Show answer
Create a typed fetch helper with generics.
Show answer
Write a custom type guard to check if a value is a User.
Show answer
Create a type where all fields are optional except id.
Show answer
A third-party library you need has no TypeScript types. What do you do?
Show answer
Your team uses 'as any' everywhere to silence errors. How do you improve this?
Show answer
Tell me about a time you convinced your team to adopt a new tool like TypeScript.
Show answer
What does structural typing mean in TypeScript?
Show answer
What does the satisfies operator do?
Show answer
Write a DeepReadonly type using mapped and conditional types.
Show answer
How would you migrate a large JavaScript codebase to TypeScript?
Show answer
TypeScript types say a field exists, but the app crashes because the API did not send it. How do you prevent this?
Show answer
Type checking takes several minutes in a large monorepo. How do you speed it up?
Show answer
Why use requestAnimationFrame instead of setTimeout for animations?
Show answer
What is a Progressive Web App?
Show answer
How do browser permission APIs like Geolocation and Notifications work?
Show answer
What are the URL and URLSearchParams APIs used for?
Show answer
Keep product filters in sync with the URL query string.
Show answer
Implement a copy-to-clipboard button with user feedback.
Show answer
A new browser API you used does not work in older Safari versions. How do you handle it?
Show answer
Tell me about a time you learned a new browser API to deliver a feature.
Show answer
What is the difference between a Web Worker and a Service Worker?
Show answer
Compare IntersectionObserver, ResizeObserver and MutationObserver.
Show answer
When should you use IndexedDB instead of localStorage?
Show answer
How does the History API enable client-side routing?
Show answer
What is the same-origin policy and how does postMessage work around it?
Show answer
How can you communicate between multiple tabs of the same site?
Show answer
Move a heavy calculation into a Web Worker.
Show answer
Detect offline status and retry queued requests when the connection returns.
Show answer
Create a simple custom element with Shadow DOM.
Show answer
When a user logs out in one tab, other open tabs stay logged in. How do you fix it?
Show answer
In a single-page app, the back button takes users out of the site instead of to the previous filter. Why?
Show answer
How do you handle unclear requirements from a product manager?
Show answer
Explain common service worker caching strategies.
Show answer
What are Web Components and Shadow DOM?
Show answer
Register a service worker that caches static assets with a cache-first strategy.
Show answer
After a deployment, some users keep seeing the old version of your PWA. Why?
Show answer
Your page embeds a payment iframe from another domain and needs its result. How do you do it safely?
Show answer
How does Tailwind CSS keep the final CSS file small?
Show answer
Does native CSS support nesting now?
Show answer
Why are dvh and svh units better than vh on mobile?
Show answer
What colour contrast ratios does WCAG require?
Show answer
What is prefers-reduced-motion and why should you respect it?
Show answer
Write a visually-hidden utility class for screen-reader-only text.
Show answer
Show clear focus styles only for keyboard users.
Show answer
Make an embedded video keep a 16:9 ratio at any width.
Show answer
A full-screen hero section is cut off at the bottom on mobile phones. How do you fix it?
Show answer
Compare CSS Modules, CSS-in-JS and utility-first CSS.
Show answer
What are design tokens?
Show answer
What does the :has() selector allow you to do?
Show answer
What are CSS logical properties?
Show answer
Animate a modal smoothly when it opens without causing layout work.
Show answer
Define brand design tokens in Tailwind CSS v4.
Show answer
Write a card that changes layout based on its container width.
Show answer
An accordion animation stutters on low-end Android phones. What is wrong?
Show answer
Your app must now support an Arabic right-to-left version. What changes are needed in CSS?
Show answer
Tailwind classes built dynamically like 'bg-' + colour work locally but are missing in production. Why?
Show answer
How do you handle a designer who expects pixel-perfect matching on every device?
Show answer
Tell me about a time you received critical feedback in a code review.
Show answer
What are CSS cascade layers and what problem do they solve?
Show answer
What is the difference between :is() and :where()?
Show answer
Several teams contribute CSS to one large app and styles keep breaking each other. What do you propose?
Show answer
You are asked to build a design system used by several products. How do you approach it?
Show answer
What are Core Web Vitals and their good thresholds?
Show answer
What are code splitting and lazy loading?
Show answer
How do you choose the right image format and size?
Show answer
How can web fonts slow a page down and how do you optimise them?
Show answer
Load a heavy module only when the user needs it.
Show answer
Add resource hints for a third-party font and the hero image.
Show answer
Product images on a listing page load slowly. What quick fixes would you apply?
Show answer
What is Interaction to Next Paint and what usually makes it poor?
Show answer
What is the difference between lab data and field data in performance?
Show answer
Explain preload, prefetch and preconnect.
Show answer
What are long tasks and why do they hurt user experience?
Show answer
How do HTTP caching headers work for frontend assets?
Show answer
Collect Core Web Vitals from real users with the web-vitals library.
Show answer
Configure cache headers for hashed assets and HTML in Nginx.
Show answer
The main JavaScript bundle is 2 MB. How do you reduce it?
Show answer
Marketing has added many third-party scripts and the site has become slow. What do you do?
Show answer
Most of your users are on low-end Android phones with slow networks. How does that change your approach?
Show answer
An audit finds twenty performance issues. How do you decide what to fix first?
Show answer
How do HTTP/2 and HTTP/3 change frontend bundling strategy?
Show answer
What is hydration and why can it hurt performance?
Show answer
Break a long-running loop into smaller tasks to keep the page responsive.
Show answer
Enforce a performance budget in CI with Lighthouse CI.
Show answer
Field data shows poor INP on the product page's Add to Cart button. How do you investigate?
Show answer
Lighthouse shows a score of 95, but Search Console reports failing Core Web Vitals. Why?
Show answer
How did you convince stakeholders to prioritise performance work over new features?
Show answer
What is a JavaScript bundler and why do frontend projects need one?
Show answer
Why is Vite faster than webpack during development?
Show answer
What are source maps and should they be deployed to production?
Show answer
Explain dependencies, devDependencies and peerDependencies.
Show answer
What do caret and tilde mean in package versions, and why commit the lockfile?
Show answer
Compare npm, pnpm and Yarn.
Show answer
What is Hot Module Replacement?
Show answer
Create a new Vite project with TypeScript and run it.
Show answer
Tell me about a time you automated a repetitive task.
Show answer
What is tree shaking and what can prevent it?
Show answer
What is transpilation and how does browserslist control it?
Show answer
How do environment variables work in frontend builds, and what is the risk?
Show answer
Why do build tools add content hashes to filenames?
Show answer
Configure a path alias and an API proxy in Vite.
Show answer
Set up ESLint with the flat config for a TypeScript project.
Show answer
Run linting and formatting automatically before each commit.
Show answer
Write a GitHub Actions workflow that lints, tests and builds a frontend app.
Show answer
The build works on your machine but fails in CI. How do you troubleshoot?
Show answer
npm audit reports a critical vulnerability in a dependency. What do you do?
Show answer
After a release, the app shows a blank page in some older browsers. What could be wrong?
Show answer
How do monorepo tools like Turborepo or Nx help frontend teams?
Show answer
Split vendor libraries into separate chunks and visualise the bundle.
Show answer
Production builds take eight minutes on an old webpack setup. How would you speed them up?
Show answer
The bundle analyser shows two copies of the same library. How do you fix it?
Show answer
Describe a disagreement with your team about choosing a tool or framework.
Show answer
What is the testing pyramid, and how does the testing trophy differ?
Show answer
What is the difference between unit, integration and end-to-end tests?
Show answer
Write a Vitest unit test for an INR price formatter.
Show answer
A bug reached production even though all tests passed. What do you do next?
Show answer
QA reports a bug that happens only in Safari on iPhone. How do you debug it?
Show answer
How do you test that a page shows the right message when an API fails?
Show answer
How do you handle a situation where a bug you wrote affected users?
Show answer
How do you work with QA engineers as a frontend developer?
Show answer
Why are many teams moving from Jest to Vitest?
Show answer
What is the guiding principle of Testing Library and why query by role?
Show answer
When should you mock in frontend tests, and what is Mock Service Worker?
Show answer
What are the pros and cons of snapshot testing?
Show answer
What is visual regression testing?
Show answer
Mock fetch in a Vitest test to check error handling.
Show answer
Write a Playwright end-to-end test for a login flow.
Show answer
Test a DOM form with Testing Library and user-event.
Show answer
You must change a complex legacy module that has no tests. How do you proceed safely?
Show answer
Management requires 100 percent code coverage, but bugs still appear. How do you respond?
Show answer
How do you test code that depends on the current date or timers?
Show answer
Tell me about a time you pushed back on releasing code without tests.
Show answer
What makes frontend tests flaky?
Show answer
Add automated accessibility checks to Playwright tests.
Show answer
End-to-end tests fail randomly in CI about one run in five. How do you stabilise them?
Show answer
The frontend test suite takes 20 minutes in CI. How do you make it faster?
Show answer
How have you built a testing culture in a frontend team?
Show answer
Compare SPA, MPA, server-side rendering and static site generation.
Show answer
How does client-side rendering affect SEO and social sharing?
Show answer
At a high level, how does React's virtual DOM and reconciliation work?
Show answer
Where do you see yourself in five years as a frontend developer?
Show answer
What is the difference between local UI state, global state and server state?
Show answer
What does component-driven development mean?
Show answer
Write a minimal observable store in plain JavaScript.
Show answer
Implement simple feature flags on the frontend.
Show answer
Write a React custom hook that fetches data and cancels on unmount.
Show answer
State is passed through many component layers and global state has become chaotic. How do you restructure it?
Show answer
Your app needs to support Hindi and English. How do you design internationalisation?
Show answer
A dashboard must show live order updates. Would you use polling, Server-Sent Events or WebSockets?
Show answer
How would you choose a frontend framework for a new project?
Show answer
Users report errors you cannot reproduce. How do you set up frontend observability?
Show answer
How do you estimate the time needed for a frontend feature?
Show answer
How do you balance technical debt against delivering new features?
Show answer
What are micro-frontends and when do they make sense?
Show answer
Where should a frontend store authentication tokens?
Show answer
Build an API client that refreshes an expired access token once and retries.
Show answer
Which rendering strategy would you choose for a large e-commerce site?
Show answer
Ten teams work on one large frontend and releases keep blocking each other. What would you propose?
Show answer
How do you secure a modern frontend application beyond what the framework provides?
Show answer
Design the frontend for a search box with autocomplete suggestions.
Show answer
Field agents need a form app that works in areas with no internet. How would you build it?
Show answer
Tell me about a frontend architecture decision you led.
Show answer
Frequently asked questions
What jobs can I get after this frontend development course?
You can apply for Frontend Developer, UI Engineer, JavaScript Developer and TypeScript Frontend Engineer roles, and with experience move into frontend performance, test automation or frontend architect positions. Product startups, fintech and e-commerce companies, SaaS firms and global capability centres in India actively hire frontend engineers. Recruiters look for strong JavaScript fundamentals, TypeScript, performance awareness and well-built projects you can explain in depth.
Who is eligible for this frontend development course?
The course suits learners who already know basic HTML, CSS and JavaScript, such as final-year students, recent graduates from any stream, web developers wanting to specialise, and backend or QA engineers moving to frontend work. If you are a complete beginner, start with a web development fundamentals course first. Comfort with building small web pages and using Git will help you get the most from the advanced topics.
How long does it take to become job-ready in frontend development?
With basic web skills and two to three hours of daily practice, most learners become job-ready for frontend roles in about three to four months, covering modern JavaScript, TypeScript, browser APIs, performance, tooling and testing. Mastering architecture and large-scale performance takes longer and grows with real project experience. Building and deploying projects every week is the fastest way to turn concepts into interview-ready skills.
Do I need to learn React for frontend jobs?
Most frontend job listings in India mention a framework, and React is the most common, so learning one is important. However, interviews at good companies test core JavaScript, TypeScript, browser behaviour, CSS and performance deeply, because frameworks change but fundamentals do not. This course builds those fundamentals and touches on framework concepts; pairing it with a dedicated React course gives you the complete skill set employers expect.
Will I get a certificate, and does it help in hiring?
You receive a course completion certificate that shows structured training in advanced frontend topics, which can help during resume screening. Hiring decisions, though, depend mostly on your technical interviews and portfolio. Combine the certificate with deployed projects that show TypeScript, good Lighthouse scores, tests and clean Git history. A well-documented GitHub profile often matters more to frontend hiring managers than any certificate.
What projects should I build to impress frontend interviewers?
Choose projects that show depth rather than many small clones: an offline-capable PWA, a typed storefront with server-rendered product pages, a reusable component library with Storybook and tests, and a performance case study where you measured and improved Core Web Vitals. Document decisions and results in the README. Interviewers often ask why you chose a pattern, so be ready to explain trade-offs.