JavaScript interview questions: code them, run them, pass the hidden tests
JavaScript interviews rarely ask for an algorithm from a textbook. They ask for the utility you would write at work: group these records, flatten this object, debounce this handler, retry this request, limit how many promises run at once. Every question below opens an editor with examples and runs your function against hidden tests, including the edge cases an interviewer will ask about.
What front-end and full-stack screens ask
- Array and object manipulation: group by, count by, unique by, chunk, zip, flatten, pick, multi-key sort, deep merge.
- Strings and dates: slugify, truncate, format money, parse a query string, add days, days between dates, format a duration.
- Data shaping: CSV to objects, totals per key, pivot to a lookup, top N with ties, running totals, nested paths, deep equality, left join.
- Functions and async: debounce, memoize, once, pipe, sleep, retry with backoff, a timeout wrapper, tasks in sequence, Promise.all with a concurrency limit.
- The follow-ups: what about an empty array, a missing key, null, ties, Unicode, a promise that never settles.
Warm-up: arrays, strings and numbers
These are the questions a screen opens with. They look trivial, and the hidden tests are where candidates fail: an empty list, negative numbers, a word with no vowels, bounds that are equal.
- Total of a list Free
- Items in stock Free
- Full names Free
- Has every tag Free
- Reverse the words Free
- Capitalize each word Pro
- Count the vowels Pro
- Clamp a number Pro
- Range of numbers Pro
Arrays and objects
Group by and unique by are the two most asked utility questions in JavaScript interviews; chunk, zip and flatten follow. Deep merge is the one that separates people who understand references from people who do not.
Strings and dates
Formatting questions test attention to edge cases: trailing hyphens in a slug, an ellipsis that fits within the limit, negative amounts, repeated query keys, month lengths and leap years.
Data shaping
The questions a data-heavy front end or a Node service needs: parse CSV with quoted fields, totals per customer, top N with ties, running totals, read a nested path safely, deep equality, flatten a nested object into dotted keys, left join two lists.
Async and higher-order functions
Implement debounce, memoize, once, pipe and sleep from scratch; then retry with backoff, a timeout wrapper, tasks run in sequence, and the question senior screens love: Promise.all with a concurrency limit.
How the questions are checked
Your function runs in your browser against the visible examples and a set of hidden tests. The feedback names the first failing case with the input and the output you returned, which is the same conversation you will have with an interviewer. After two attempts the hidden inputs are revealed, and a reference solution opens.
Code the questions
Five exercises are free without an account. Pro unlocks all 45, with hidden tests, hints, reference solutions and progress saved to your account.
Start practicing freeQuestions
Which JavaScript version?
Modern JavaScript as it runs in current browsers and Node: ES modules syntax is not needed, but arrow functions, destructuring, spread, Map and Set, async/await and optional chaining all work.
Are these LeetCode-style algorithm questions?
No. They are the practical utility questions front-end and full-stack interviews actually ask. For data structures and algorithms use a dedicated site; for the JavaScript you will be asked to write on the spot, this set is closer.
Can I use TypeScript?
The editor runs JavaScript. Write plain JavaScript; the solutions are easy to annotate afterwards if you want to practice types.
Do I need Node installed?
No. Everything runs in the browser, including the async exercises, which use real timers and promises.