12 JavaScript Coding Challenges Interviewers Actually Ask
Twelve JavaScript challenges common in frontend and Node.js interviews, from debounce and deep clone to Promise.all, with solutions to study.
JavaScript interviews for frontend and Node.js roles often skip classic algorithm puzzles in favour of practical challenges: implement a utility you would actually use, or reproduce a built-in. These questions test closures, the event loop, promises, `this`, and how carefully you handle edge cases. Here are twelve that come up frequently, with compact solutions and what interviewers look for. Try each yourself before reading the solution.
1. Debounce
Delay calling a function until a pause in calls — used for search boxes and resize handlers.
Talking points: the closure keeping `timer`, preserving `this` and arguments, and how you would add a `cancel` method or a leading-edge option.
2. Throttle
Allow a function to run at most once per interval — useful for scroll handlers.
Be ready to explain the difference between debounce and throttle with a real example.
3. Implement Promise.all
Interviewers check: order preserved by index, non-promise values handled, empty input, and fast rejection.
4. Deep clone
Mention circular references (handled by the `WeakMap`), what is not handled (Dates, Maps, Sets, class instances), and that `structuredClone` exists in modern environments.
5. Flatten a nested array
Follow-up: write it iteratively with a stack to avoid deep recursion.
6. Event emitter
Discuss returning an unsubscribe function, a `once` method, and what happens if a handler throws.
7. Memoize
Point out the limits of `JSON.stringify` keys and the risk of unbounded caches.
8. Implement Function.prototype.bind
This checks your understanding of `this`, `apply` and partial application.
9. Retry with backoff
A practical favourite for Node.js roles. Discuss which errors should not be retried.
10. Limit concurrency
Run async tasks with at most `n` in flight — common in backend interviews.
11. Group by
12. Predict the output (event loop)
Explain why: synchronous code runs first, then microtasks (promise callbacks), then macrotasks (timers).
After writing each solution, say aloud what inputs could break it — empty arrays, `null`, circular objects, rejected promises. Interviewers listen for this as much as for working code.
What interviewers look for beyond a working answer
Correct code is the baseline. What separates candidates is how they get there: clarifying the requirements first ("Should debounce support immediate execution?"), choosing readable names, handling errors and edge cases without being prompted, and explaining the complexity of their solution. Interviewers also watch how you react to a hint or a bug. Calmly adding a `console.log`, testing a small input and fixing the issue shows exactly the habits a team wants. Silence followed by a rewrite from scratch does not.
How to practise
- Write each solution from scratch without looking, then compare.
- Add small tests with `console.assert` or Jest for edge cases.
- Explain each one out loud in under two minutes.
- Revisit the ones you struggled with after three days.
Getting to the round
These challenges matter once you reach the technical interview. Make sure your resume names your JavaScript stack clearly — the Algnetic ATS resume builder checks it against a posting — and let auto-apply keep applications moving while you practise.
Key takeaways
- Practical utilities (debounce, Promise.all, deep clone, event emitter) are as common as algorithm puzzles.
- Interviewers look for closures, async handling, `this`, and edge-case thinking.
- Explain trade-offs and limitations, not just the happy path.
- Practise writing from scratch and talking through your code.
Let Algnetic apply to matching jobs for you · More career guides
Related guides
https://algnetic.com/blog/javascript-coding-challenges-to-practice