home
navigate_next
Blog
navigate_next
Technical Interviews

7 Tricky Frontend Interview Questions (How To Answer Like a Senior Dev)

In the past year, Bogdan and I did over 150+ frontend technical interviews

While doing them, we noticed a weird pattern:

Most frontend developers fails technical interviews – not because they don’t know what they are a being asked about. 

But because they fail to demonstrate Senior-level skills as they answer the interview questions.

Below, you will find the 7 most asked questions in frontend interviews in 2025 – and how to answer them like a Senior Frontend Developers who deserves a $100+ job. 

Btw, Bogdan and I answered these questions on our YouTube channel. You can watch it here:

If you are doing technical interviews at the moment, there’s also a free assessment at the end of this article. 

1. Cookies vs localStorage vs sessionStorage – What’s Difference?

Most frontend devs get this one right - but not in a structured way that signals true Seniority. 

Here’s a simplified version:

Concept

Cookies

localStorage

sessionStorage

Storage Limit

~4 KB

~5–10 MB

~5 MB

Persistency

Custom expiry

Forever (until manually cleared)

Only until tab/browser closed

Sent on HTTP Requests

✅ Yes

❌ No

❌ No

Use Case

Auth tokens, server sync

Persisting UI/app state

Temporary form inputs

Senior Dev Tip: Use HTTP-only cookies (with Secure and SameSite flags) for tokens. Never store JWTs in localStorage if you care about security.

2. How do you Optimize a React App for Performance (Like a Senior Engineer)

This question gets asked in almost every frontend interview these days. It might seem simple, but is an open-ended question

Meaning, getting it right won’t be enough. You need to show real technical depth. 

Here’s a framework you can use to answer it:

🧱 In the Bundler (e.g., Webpack or Vite):
  • Add a polyfill: Ensure backward compatibility for older browsers (Internet Explorer 💀)
  • Enable Compression: Serve .gz or .br files instead of uncompressed JS.
  • Minify/Uglify Your Code: Shrink your bundle size with fewer readable characters.
  • Source Maps: Keep debugging possible in production.
  • Code Splitting: Only load what's needed for the current route or component.
🌍 Post-Bundling:
  • Use a CDN: It distributes assets globally for faster access. 
  • Optimize Images: Compress, lazy-load, use ‘webp’, and apply ‘srcset’ for responsive delivery. 

3. We’ve got Big Image Assets and a Slow Website: How Would You Fix It?

To answer this question, you have to stop thinking like a frontend developer, and think like a product engineer.

Here’s a web performance checklist for dealing with large image assets:

  • Use the right dimensions - why load a 3,000px image if it is going to render at 800px? Compress and minimize, my frontend friend. 
  • You can use tools like ImageOptim to compress images (or build your own image compression pipeline).
  • Serve images in WebP or AVIF format whenever possible.
  • Lazy-load anything outside the viewport (loading="lazy").
  • Sever via CDN with proper caching headers. 
  • User ‘srcset’ to load different image sizes for different devices.

4. How do you Ensure Code Quality in Large-Scale Frontend Projects?

The best frontend engineers I know don’t just push code or ship features.

They ship clean, maintainable code that they won’t have to roll back 3 weeks after the release. 

Here’s a Code Quality Setup we recommend to frontend engineers:

  • Use Linters & Formatters: ESLint, Prettier & Stylelint.
  • Use TypeScript: yes, on strict mode.
  • Write tests: Unit (Jest), End-to-end (Playwright or Cypress).
  • Accessibility: eslint-plugin-jsx-a11y or similar. 
  • Performance Monitoring: Lighthouse, Web Vitals, Sentry. 

5. What is XSS (Cross-Site Scripting) and How to Prevent It in React?

XSS = Cross-Side Scripting. 

In plain English - it’s when someone injects malicious JavaScript into your application - usually via text inputs - and it gets injected into the database (and executed on other’s people browser).

2 things to remember:

  1. Sanitize input: Never blindly trust user input – validate and clean it before saving it to the database.
  2. Escape output: Avoid rendering raw HTML or using ‘dangerouslySetInnerHTML’ in React unless 100% necessary. 

If you are using CMS content or any kind of Markdowns renderers on CMS content, always sanitize output too. 

6. How do CDNs Work? (and Why Should We Use One)

You can’t afford to miss this one as a frontend dev.

Think of a CDN(Content Delivery Network) as a copy-past machine with server all over the world. 

So, instead of fetching static assets (JS, CSS, images) all over again from your server when the user requests them… You serve them from the closest “edge location” – less distance means a lot less latency. 

Main benefits of CDNs:

  • Lower TTFB (Time to First Byte)
  • Better caching
  • Fail safe - in case the origin server goes down

Most popular CDN providers: Cloudfare, AWS CloudFront, Vercel (built-in).

Senior Dev Tip: I personally love Clourdfare. At theSeniorDev we have it set up almost everywhere.

7. What Are Micro-Frontends, and When Should You Actually Use Them?

We’ve got this question over and over in our frontend interviews. 

They ask it because they know few frontend developers actually understand Micro-frontends… Knowing how they work will 100& position you as a Senior Dev.

Micro-frontends = Splitting your frontend application into multiple smaller frontend applications. So you can develop and deploy them independently.

Super useful if:

  • Your team has 30+ frontend engineers.
  • Your teams are spending too much time managing releases and commits. 
  • You moonlight is becoming a bottleneck in the development process. 

But… Micro-frontends also introduce:

  • Shared state (and its complexity).
  • More DevOps overhead - more service provisioning.
  • More need for clear interfaces and cross-team coordination.

Rule of thumb: Don’t do it unless your org is feeling real pain.

Bonus: The #1 Mistake Developers Make in Frontend Interviews (And How to Avoid It)

Simple: They focus way too much on the UI - and almost ignore the backend of that frontend.

Senior Frontend Devs pay attention to: 

  • Web Performance & Core Vitals 
  • Tooling (& FE productivity)
  • Deployment & Infrastructure
  • Web Security 
  • Frontend Architecture 

This multidimensional view of the frontend is what makes the difference between Juniors who get rejected… And Seniors who get the job. 

✅ Take Our Free Frontend Interview Assessment

We collect all technical interview question our students have been getting over the years…

And we created a free 10-minutes technical quiz that tells you:

  1. Your exact technical Gaps to Senior 
  2. What to work on before your next frontend interview 
  3. How you stand respect to Senior Frontend Engineers

👉 Click here to take the free assessment

🚀 Want to Get to Senior? We’ll Get You There. Or You Don’t Pay.

In the last 5 years, Bogdan and I helped over 350+ JavaScript devs (Frontend, Backend & Full-stack) move up to Senior.

Book a call with us to see if you are fit →

Till' the next one,

Dragos

Find Your Technical Gaps With This FREE 10-Minutes Technical Assessment

Take The FREE Technical Assessement
close
🎯 FREE Technical Interview Cheat Sheet
25 Top Interview Questions for JavaScript Devs in 2025. Frontend, Backend & Full-stack.
Please provide a valid email.
Please wait, you are being redirected.... 😊
PDF in your inbox in 10 seconds.
Oops! Something went wrong while submitting the form.
Well done!
check_circle
We have sent the PDF with the questions to the email you have provided.
CLOSE