A frontend mock interview with AI should rehearse the rounds frontend loops commonly include: JavaScript fundamentals, building a UI component from a spec, browser performance and accessibility, and frontend system design at mid and senior levels. An AI can quiz you on the event loop and React rendering, play the interviewer who hands you a component spec and asks follow-ups, and review your code afterwards. It can't watch you build or click through your UI, so build in a local project or a browser sandbox with a timer running, and test the result with your keyboard yourself.
The rounds to mock
| Round | Common format | How to mock it with AI |
|---|---|---|
| JavaScript fundamentals | About 45 minutes of discussion and small snippets: closures, async, this, prototypes | Output drills and follow-ups on mechanisms |
| Build a component | About 60 minutes of live coding from a spec | The AI writes the spec and asks follow-ups; you build it locally |
| Browser and performance | Rendering, loading and Core Web Vitals | Explain-it-out-loud questions with a scenario |
| Frontend system design | Mid level and up: component architecture, state, data fetching | A design prompt with spoken trade-offs |
| Accessibility | Often folded into the build | A keyboard and labels check in every review |
The formats above are typical rather than universal; our frontend interview questions guide covers each round in more depth.
Questions to rehearse
JavaScript
- What does this log, and why?
console.log('A'); setTimeout(() => console.log('B'), 0); Promise.resolve().then(() => console.log('C')); console.log('D');(Answer: A, D, C, B. Synchronous code first, then promise callbacks as microtasks, then the timer.) - Why does
for (var i = 0; i < 3; i++) setTimeout(() => console.log(i));log 3 three times, and why doesletfix it? (One sharedvarbinding versus a newletbinding per iteration.) - How does
thisdiffer between an arrow function and a regular method? - Implement
debounce. When would you use throttle instead?
More are in our JavaScript interview questions.
React, if the role uses it
- Why is an array index a poor key when list items can be reordered or removed?
- When does a
useEffectcleanup run, and what leaks without one? (Before the effect runs again and when the component unmounts; timers and subscriptions leak.) - Why might
React.memofail to prevent a re-render? (New object or function props on every render.)
See our React interview questions for the rest.
Browser, performance and accessibility
- What do LCP, INP and CLS measure, and how would you improve a slow LCP?
- Why use a
<button>rather than a clickable<div>? (Focus, Enter and Space activation and the button role come built in.) - How should focus behave when a modal opens and closes?
- When would you choose CSS grid over flexbox?
Build and design
- Build an autocomplete input that fetches suggestions as the user types, with debounced requests, keyboard navigation and handling for responses that arrive out of order.
- Design the client side of a news feed with infinite scroll; our frontend system design interview guide has a structure.
A 60-minute component-build session
| Minutes | Phase | What you do |
|---|---|---|
| 0–5 | Spec | Read it back, ask about browsers, data source, loading and error states |
| 5–10 | Plan out loud | Component tree, state, events, and the accessibility approach |
| 10–45 | Build | Code it in a local project or sandbox, narrating decisions |
| 45–52 | Follow-ups | Race conditions, slow networks, keyboard-only use |
| 52–60 | Review | Paste your code in; fix the top issue if time allows |
A voice AI hears your plan but doesn't see your screen, so say each decision as you make it (“I'm keeping the highlighted index in state so arrow keys can move it”) and paste the code in at the end.
Prompt: hand me a component spec
Act as a frontend interviewer. Give me a spec for a UI component I can build in 35 minutes in [vanilla JavaScript / React / my framework], such as an autocomplete, tabs, a star rating or an image carousel. Include 3 functional requirements, 1 accessibility requirement and 1 edge case, but don't tell me how to build it. Answer my clarifying questions briefly. When I say 'done', ask me three follow-ups: one on performance, one on accessibility and one on a failure case such as a slow or failed network request.
Why it works: the spec is fresh each time, and the three follow-ups match what component rounds commonly probe.
Prompt: review my component
Here is the spec and my code: [paste both]. Review in this order: bugs, with steps to reproduce; race conditions and leaks (timers, listeners, effects without cleanup); accessibility (keyboard use, focus, labels, roles, and ARIA only where native HTML isn't enough); then performance and readability. Don't rewrite the whole component; show the smallest change for each issue.
Why it works: it puts the costly problems (bugs, leaks, inaccessible controls) before style.
Prompt: JavaScript output drills
Give me 6 short JavaScript snippets on the event loop, closures, 'this', hoisting and promise chaining. Ask what each logs and why. Reveal the answer only after I reply, then state the rule in one sentence.
Why it works: output questions are fast, common and unforgiving. Paste each snippet into your browser console afterwards to confirm the answer.
Worked example: debounce, said out loud
A version you can write in about two minutes, which we ran in Node before publishing:
function debounce(fn, wait) { let t; return function (...args) { clearTimeout(t); t = setTimeout(() => fn.apply(this, args), wait); }; }
- What it does: “Every call clears the pending timer and starts a new one, so
fnruns once,waitmilliseconds after the last call.” - Why a regular function for the wrapper: “So
thisis whatever the caller used; the arrow function inside keeps thatthis, andapplypasses it on with the latest arguments.” - When to use it: “For a search box, debounce, so we request once the user pauses. For a scroll handler, throttle, so it runs at a steady rate while scrolling continues.”
- Likely follow-ups: a leading-edge option, a
cancelmethod, and what happens to a request already in flight when a newer one starts.
That last follow-up is the autocomplete race condition: ignore or abort responses for queries that are no longer current, or an older, slower response can overwrite newer results.
Rubric for a frontend mock
| Criterion | Strong | Weak |
|---|---|---|
| JavaScript fundamentals | Explains the mechanism, such as microtasks before timers | Guesses output order |
| Meets the spec | Every requirement works, including the edge case | The happy path only |
| State and data | Loading, error and out-of-order responses handled | The last response always wins |
| Accessibility | Works with a keyboard, focus is managed, controls are labelled | Mouse-only, unlabeled inputs |
| Performance | Debounced input, no needless re-renders, cleanup in place | A request per keystroke, leaking timers |
| Communication | Plans aloud before building and narrates trade-offs | Silent building |
A two-week plan
- Days 1–3: JavaScript output drills and follow-ups, 20 minutes a day.
- Days 4–9: one component build a day from a fresh AI spec, reviewed with the second prompt; tab through each result with the keyboard only.
- Days 10–11: browser, performance and accessibility questions; review semantics and layout with our HTML and CSS interview questions.
- Day 12: one frontend system design session (mid level and up).
- Day 13: a full 60-minute build with a person watching, if you can get one.
- Day 14: review your list of review findings, then rest.
What an AI mock can't check for you
- Your UI. The AI can't click through what you built. Test it yourself with the keyboard and your browser's developer tools.
- Assistive technology. Try your component once with a screen reader; a code review only catches part of what users hear.
- A shared editor. Some rounds use an online editor where the interviewer watches you build. Practice once in that setup with a person.
- Take-homes and assessments. Follow their stated rules on AI; many forbid outside help.
Where CoPilot Interview fits
CoPilot Interview is an AI interview assistant whose free AI mock interview builds technical questions from your résumé and the job description, reads them aloud and scores each spoken answer out of 10, a quick way to practice explaining the event loop, rendering or an accessibility decision out loud. The free plan gives 15 minutes a day of live help in sessions of up to 15 minutes, with AI mock interviews included. It scores what you say, so keep building and reviewing components separately. Take-homes and live rounds set their own rules, so prepare with it and follow your employer's rules.
Disclosure: CoPilot Interview is our product, so weigh what we say about it accordingly.
Frequently asked questions
What is asked in a frontend mock interview?
JavaScript fundamentals (event loop, closures, this), a component build from a spec, browser performance and accessibility questions, and, from mid level up, frontend system design. React questions come up when the role uses React.
Can AI review my frontend code?
Yes. Paste the spec and your code and ask for bugs, race conditions, leaks and accessibility issues before style. It can't run your UI, so test with the keyboard and developer tools yourself.
How long is a frontend component round?
Component builds commonly run about an hour. Practice building the core in 35 minutes so there's time for follow-ups and fixes.
What are LCP, INP and CLS?
Core Web Vitals: Largest Contentful Paint measures loading, Interaction to Next Paint measures responsiveness to input, and Cumulative Layout Shift measures visual stability.
Rehearse it out loud before the real one
The AI mock interview builds questions from your resume and the job description, reads them aloud and scores each spoken answer out of 10. Included on the free plan.
Start a mock interview