67 frontend interview questions, each written out the way you would actually say it in the room — the analogy first, then the mechanism, then the follow-up they ask next. Scan the contents, or open a card for the full answer.
50Mock round
What is the CSS box model, and how does the box-sizing property change how width and height are calculated?
Read the answer →
51Mock round
When you click on a nested element, how does the browser decide which event handlers run, and in what order?
Read the answer →
52Mock round
A page renders 2,000 items and filters them as the user types in a search box. The UI freezes for a moment on every keystroke. What would you investigate, and what would you try first?
Read the answer →
54Mock round
The app is one giant component that conditionally renders views based on a boolean flag. How would you design basic client-side routing for a handful of pages — Home, Profile, Settings?
Read the answer →
55Mock round
Buttons and inputs are copy-pasted across pages, so styling and behaviour have drifted. How would you structure a simple shared component library — buttons, inputs, cards — for several pages…
Read the answer →
01Code tasks
Write a setTimeout polyfill using the Promise constructor — and make it cancellable, like the real one.
Read the answer →
02Code tasks
Build a React timer component with Start, Pause and Reset buttons.
Read the answer →
03Code tasks
Render a list with a text input: typing and submitting adds an item, each row can be deleted.
Read the answer →
14Code tasks
What is a polyfill, and how would you write one — say Array.prototype.flat or Function.prototype.bind?
Read the answer →
24Code tasks
Implement throttle. What is the difference between throttling and debouncing, and when do you use each?
Read the answer →
26Code tasks
Write a useDebounce hook for a search box — one request after the user stops typing, not one per keystroke. Then explain cleanup in React.
Read the answer →
48Code tasks
What does this snippet print, and in what order? Walk through it out loud as you go.
Read the answer →
49Code tasks
Which console.log runs — on the first render, and then on a click?
Read the answer →
53Code tasks
Given a string of words separated by one or more spaces, possibly with leading and trailing spaces, return the length of the last word. There is always at least one.
Read the answer →
56Code tasks
Implement curry so that a three-argument function can also be called one argument at a time. Then show what it buys you.
Read the answer →
05JavaScript
Analogy: a closure is a function that leaves the room carrying a backpack. Whatever variables were in scope when it was created go with it wherever it is called, and nobody outside can reach…
Read the answer →
12JavaScript
Analogy: shallow copy = photocopying a page that has addresses written on it. You get a new page, but both pages point to the same houses. Deep copy = rebuilding the houses too.
Read the answer →
13JavaScript
Analogy: let and const are a note left on a desk in one room — walk out of the {} and it is gone. var ignores rooms entirely and belongs to the whole floor (the function), which is why it le…
Read the answer →
25JavaScript
Analogy: a function like greet() says "Hi, my name is …" without knowing whose mouth it is in. These three decide who is speaking. call and apply say it right now on someone's behalf (the on…
Read the answer →
37JavaScript
The one-line map of all six. Array = a numbered queue. Object = a form with printed labels (labels must be words). Map = a cloakroom: hand in a ticket, get the coat back — and the ticket can…
Read the answer →
38JavaScript
A Set is just a list that refuses duplicates. Picture a plain array — same thing, one extra rule: the same value can never go in twice. You have ["a", "b", "c"] and you try to add another "b…
Read the answer →
39JavaScript
Analogy — the cloakroom at a theatre. You hand over your coat and you get a numbered ticket. When you come back, the attendant does not walk down the rail looking at every coat until they sp…
Read the answer →
40JavaScript
One line: an Object is a form with field labels printed on it — a known, fixed shape you fill in: name, email, age. A Map is an empty filing cabinet — you add and pull drawers all day and yo…
Read the answer →
41JavaScript
Analogy — the lost property office vs. a sticky note. A normal Map is the lost property office: once an umbrella is logged in there, it stays in the building forever, because the office is s…
Read the answer →
42JavaScript
Where the line is: a WeakMap remembers something about an object — "this row is 42px tall". A WeakSet remembers only that you have seen an object — "I already dealt with this one". It is the…
Read the answer →
44JavaScript
Analogy: an object literal is writing one thing by hand. A class or constructor is a cookie cutter — stamp out a hundred, and they all share one recipe card (the prototype) rather than each…
Read the answer →
45JavaScript
Why copying is a question at all. Objects are held by reference, so const b = a does not copy anything — both names point at the same object, and "changing b" changes what a sees too. Copyin…
Read the answer →
46JavaScript
Analogy: a property is not a value, it is a file with permission bits on it. Can it be overwritten (writable)? Does it show up when someone lists the folder (enumerable)? Can it be deleted o…
Read the answer →
47JavaScript
Analogy: a normal function is a vending machine that dumps the whole shelf at once — one press, everything falls out, done. A generator is a ticket dispenser: you press it, you get number 1,…
Read the answer →
58JavaScript
What is the difference between prototypal and classical inheritance — and which one does JavaScript have?
Read the answer →
11Async & timers
Walk me through the event loop — and then tell me what this snippet prints, and why.
Read the answer →
43Async & timers
Analogy — you send three friends out to pick things up. They all leave at the same time no matter which method you pick; the only question is what you do when one of them fails. all: if anyb…
Read the answer →
16React
What is the difference between the Virtual DOM and the real DOM — and is the Virtual DOM faster?
Read the answer →
17React
Analogy: Virtual DOM vs Real DOM was "compare the blueprints." This is how the comparison is run. Imagine the renovation list is huge and the client keeps walking in with urgent changes. The old React read the…
Read the answer →
23React
Analogy: a ref is a pocket. You can put something in it and take it out later, it stays with you across re-renders — and nobody can see what is in it, so putting something in does not change…
Read the answer →
27React
Analogy: same idea at two different sizes. useMemo is keeping one ingredient you already chopped. React.memo is keeping the whole finished dish and not cooking it again because the order has…
Read the answer →
28React
Analogy: you do not rearrange a room by shoving furniture around while people watch. You sketch the new arrangement (render — cheap, on paper, throw it away if you change your mind), compare…
Read the answer →
29React
Analogy: the stage is set but the curtain has not gone up yet. useLayoutEffect is your last chance to walk out and move a chair while the audience still cannot see. useEffect runs after the…
Read the answer →
30React
Analogy: who holds the pen? Controlled = you are reading over the user's shoulder and writing every letter into your own notebook as they type; the notebook is the truth, the paper just mirr…
Read the answer →
31React
Analogy for the rule everyone breaks: React stores your hooks in numbered lockers, assigned by the order you asked for them — not by name. First useState gets locker 1, the next gets locker…
Read the answer →
34React
Analogy: prop drilling is passing a note through six people who do not care what it says just to reach the person at the end — and every one of them has to be told the note exists, so changi…
Read the answer →
35React
Analogy: Redux is a bank ledger. You never reach in and edit the balance; you write down a transaction ("deposited 50"), and the balance is whatever you get from replaying the transactions.…
Read the answer →
36React
Analogy: a blank form template versus the clerk who fills it in. The template knows nothing about where the data comes from, so you can reuse it or photocopy it for a demo. The clerk knows t…
Read the answer →
60React
A form needs to focus the <Input> component you wrote after a failed validation. Why doesn't passing it a ref work, and how do you make it work?
Read the answer →
61React
You have a <Modal> that the parent needs to open and close. How would you expose that, and when is a ref the right call instead of props?
Read the answer →
62React
Walk me through a component's lifecycle. Where does each phase live in a function component, and how does that map to the class methods?
Read the answer →
64React
Plain version: it looks like HTML sitting inside JavaScript. It isn't. The browser never sees a line of it — a build step rewrites it into ordinary function calls before it ships, and those…
Read the answer →
65React
What is the difference between props and state, and how do you decide which one a piece of data should be?
Read the answer →
66React
A search box sits above 10,000 rows and filtering takes 200ms. Typing feels broken. What are useTransition and useDeferredValue doing about it, and which one would you reach for?
Read the answer →
06Performance
Web Vitals are Google's attempt to turn "does this site feel good to use?" into numbers you can measure.
Read the answer →
20Performance
Analogy: both are a note on the fridge saying "already did this, here is the answer." Useful when the task was genuinely expensive. Silly when the task was "add two numbers" — now you are pa…
Read the answer →
21Performance
Analogy: you are flying somewhere for the weekend. Code splitting is not packing your whole wardrobe. Take what you need on arrival; have the rest shipped only if you actually go somewhere t…
Read the answer →
22Performance
The rule before any of the tooling: you cannot fix what you have not located. "The app feels slow" is a symptom with at least three unrelated causes (How to optimize performance in a React app), and guessing between them is how p…
Read the answer →
32Performance
Analogy: "the app is slow" is like "the car is making a noise." It could be too much luggage (bundle size), driving in circles (re-rendering more than needed), or the engine struggling (expe…
Read the answer →
33Performance
Analogy: a spreadsheet with 100,000 rows does not hurt your computer, because the screen only ever holds about 30 of them and the scrollbar is a lie about how much is below. That is exactly…
Read the answer →
63Performance
A page makes a lot of API calls and feels slow. Walk me through what you would look for, in order.
Read the answer →
07Browser & network
Analogy: HTTP is sending letters. You write, you wait for a reply, and every letter needs its own envelope, stamp and address. A WebSocket is a phone call you leave open: you pay the setup c…
Read the answer →
08Browser & network
Letters versus an open phone line (WebSockets). A product page wants letters — each one is self-contained, so a CDN can photocopy it and hand it to the next thousand people. A chat app wants the pho…
Read the answer →
09Browser & network
Analogy: your app is a one-person kitchen. The chef (main thread) takes orders, cooks and plates. If the chef starts peeling 10,000 potatoes, nobody gets served — the UI freezes. A Web Worke…
Read the answer →
18Browser & network
Analogy: building a room. HTML is the list of furniture, CSS is the instructions for how it should look. The browser will not let anyone in until it has both — that is why CSS is render-bloc…
Read the answer →
15Security
The two big ones in one line each. XSS is a stranger getting to write on your page — once their script runs, it runs with your page's permissions, so it can read the user's token. CSRF is a…
Read the answer →
04Architecture & tooling
Topic Say this Monorepo Shared code + one toolchain + atomic cross-package changes; costs are slower CI and tooling complexity. Needs caching (Turborepo/Nx) and affected-only builds to stay…
Read the answer →
10Architecture & tooling
Analogy: a factory assembly line for your source files. Raw materials go in one end, a boxed product comes out the other.
Read the answer →
19Architecture & tooling
Analogy — a restaurant. SSG is a cold display case: everything was cooked this morning, you grab it and leave. ISR is the same case, but a cook quietly replaces a tray when it gets old. SSR…
Read the answer →
57Architecture & tooling
Which design patterns do you actually use in JavaScript, and when would you reach for one?
Read the answer →
59Architecture & tooling
Runtime, build time, compile time — are they the same thing? Where does the distinction actually bite you?
Read the answer →
67Architecture & tooling
What is dynamic routing, and what does it buy you over declaring the routes yourself?