Frontend Interview Questions and Answers
A frontend interview spans JavaScript, React and CSS. Here's a cross-section of the questions you'll actually be asked, answered concisely.
What is a closure? (JavaScript)
A function that retains access to variables from the scope where it was defined, even after that scope has returned. It's the most-tested JS concept — it powers private state, memoization and debounce/throttle.
Explain the event loop. (JavaScript)
Single-threaded JS offloads async work to host APIs; when the call stack is empty the event loop runs queued callbacks. Microtasks (promises) always run before the next macrotask (setTimeout).
What's the difference between props and state? (React)
Props are read-only inputs from a parent; state is private data a component owns and updates. Changing state re-renders the component; props must never be mutated.
Flexbox vs Grid — when do you use each? (CSS)
Flexbox for one dimension (a row or column — navbars, toolbars); Grid for two dimensions at once (page layouts, card galleries). They're often composed together.
What is the box model and box-sizing? (CSS)
Every element is content + padding + border + margin. box-sizing: border-box makes width include padding and border, so the box is exactly the size you set — the most useful CSS reset.
Debounce vs throttle? (JavaScript)
Debounce waits for activity to stop then runs once (search-as-you-type); throttle runs at most once per interval (scroll/resize). Both rely on closures holding timer state.
Prep everything in one place
JS, React, HTML/CSS, TypeScript, system design and negotiation — 13 PDFs in the Complete Frontend Kit.
⚡ Get the Complete Frontend Kit → ₹499Frequently asked questions
- What should I study for a frontend interview?
- JavaScript fundamentals, React (hooks, rendering, keys), HTML/CSS (box model, Flexbox, Grid, accessibility), and machine-coding patterns. System design at mid+ levels.
- Is HTML/CSS still asked for React roles?
- Yes — layout, specificity and accessibility come up regularly, and many candidates lose easy points by neglecting them.
