Frontend developer interview questions and answers
Frontend interviews test JavaScript fundamentals first, then React and CSS, then how you think about performance and users. These are the questions asked most, with what each one checks.
What to revise before the interview
- JavaScript: scope, closures, this, hoisting
- The event loop, promises and async/await
- DOM events: bubbling, delegation
- React: components, props, state, hooks
- useEffect and its dependency array
- State management: context, Redux or alternatives
- CSS: box model, flexbox, grid, responsive design
- Performance and accessibility basics
1.What is a closure? Give an example.
- What they're checking
- The most common JavaScript fundamentals question.
- How to answer
- A closure is a function that remembers variables from the scope where it was created, even after that scope has finished.
- Example answer
- “function counter() { let count = 0; return () => ++count; } - each call to the returned function increases the same count, which nothing else can touch.”
2.Explain the event loop.
- What they're checking
- Whether you understand how async JavaScript actually runs.
- How to answer
- JavaScript runs one thing at a time on the call stack. Async callbacks wait in queues; when the stack is empty, microtasks (promise callbacks) run first, then the next task (like a setTimeout callback).
3.What is the difference between == and ===?
- What they're checking
- Basics and attention to detail.
- How to answer
- == converts types before comparing; === compares value and type without conversion. Use === by default.
4.What is event delegation?
- What they're checking
- DOM knowledge and efficient code.
- How to answer
- Attach one listener to a parent instead of many to children, and use event.target to see which child was clicked. It works because events bubble up.
5.How does useEffect work, and what is the dependency array for?
- What they're checking
- The React hook people get wrong most.
- How to answer
- useEffect runs after render. The dependency array controls when it re-runs: empty means once on mount; listed values mean when they change. Return a cleanup function for subscriptions and timers.
6.Why do lists in React need keys?
- What they're checking
- Understanding reconciliation.
- How to answer
- Keys tell React which item is which between renders, so it can update, add or remove the right elements. Use stable IDs, not array indexes, when items can reorder.
7.When would you use Context, and when a state library like Redux?
- What they're checking
- Architecture judgement.
- How to answer
- Context suits values many components read but rarely change - theme, user. A state library helps with large, frequently changing shared state and tooling. Keep state local whenever you can.
8.Flexbox vs Grid - when do you use each?
- What they're checking
- Practical CSS skill.
- How to answer
- Flexbox lays things out in one direction - a navbar, a row of buttons. Grid handles two dimensions - page layouts, card grids. They work well together.
9.How would you make a slow page faster?
- What they're checking
- Performance thinking.
- How to answer
- Measure first (Lighthouse, the Performance panel). Then: smaller bundles with code splitting, compressed and lazy-loaded images, fewer re-renders (memo, stable props), and caching API calls.
10.How do you make a site accessible?
- What they're checking
- Increasingly asked; shows care for users.
- How to answer
- Semantic HTML (button, nav, label), alt text for images, keyboard navigation and visible focus, enough colour contrast, and ARIA only where HTML isn't enough.
On a live call, Cuelyte AI hears questions like these and has an answer ready in about a second, built from your resume and notes. Coding interviews: how Cuelyte AI helps
Frequently asked questions
What should freshers prepare for frontend interviews?
HTML, CSS (flexbox, grid, responsive design), JavaScript fundamentals (closures, promises, array methods) and React basics. A small deployed project you can explain helps a lot.
Do frontend interviews have coding rounds?
Often - JavaScript problems such as debounce, array manipulation or building a small component live, plus sometimes general data-structure questions.
Is TypeScript asked in frontend interviews?
Increasingly. Know basic types, interfaces, generics and how you typed props and state in a project.
Company interview guides for this role
- Flipkart interview questions
- Swiggy interview questions
- Zomato interview questions
- Razorpay interview questions
- Atlassian interview questions
Related roles and topics
- Full stack developer interview questions
- UI/UX designer interview questions
- Android developer interview questions
- Automation tester interview questions
- HR interview questions
- Behavioural interview questions
- Coding interview questions
- System design interview questions
- Interview questions for freshers
- Sales interview questions
- All roles →
Practise these questions for your next interview
Add your resume to Cuelyte AI, type a question and get a clear answer in your own words - in English, Hindi or Hinglish. Free to start.