Async interview questions
Practice 62 questions on async. Each runs in a real in-browser editor with Jest tests and a worked, diagram-backed solution.
62 questions
- EASY
Async CountDown Latch
Implement a countdown latch whose wait resolves once countDown has been called the required number of times.
15 minJavaScript - EASY
Cursor Pagination Fetcher
Fetch successive pages with an opaque cursor, accumulating items and tracking whether more remain.
15 minJavaScript - EASY
Promise Waterfall
Run async tasks in sequence, feeding each result into the next, stopping the chain on the first rejection.
15 minJavaScript - EASY
Promise.race
Implement Promise.race so it settles with the outcome of whichever input promise settles first.
15 minJavaScript - EASY
Sleep
Implement a function that returns a promise resolving after the specified number of milliseconds.
15 minJavaScript - MEDIUM
Abortable Fetch with Timeout
PREMIUMFetch with a timeout that aborts the request via AbortController and honors an external abort signal.
25 minJavaScript - MEDIUM
Analytics Event SDK
PREMIUMBuild an analytics client that queues tracked events, flushes them in batches, and retries failed sends with backoff.
25 minJavaScript - MEDIUM
Array.fromAsync
Implement Array.fromAsync: build a promise of an array from a sync or async iterable, awaiting each value in order.
30 minJavaScript - MEDIUM
Async Autocomplete
Build an autocomplete that debounces typing, fetches matching results from an API, and handles loading and stale responses.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Async Debounce (Latest Wins)
Implement an async debounce that resolves only the newest call and discards the results of superseded ones.
25 minJavaScript - MEDIUM
Async Memoize with TTL
Implement an async memoize that caches results by key for a TTL and coalesces concurrent calls for the same key.
25 minJavaScript - MEDIUM
Async Mutex
PREMIUMImplement an async mutex whose acquire returns a release function, serializing access so only one holder runs at a time.
25 minJavaScript - MEDIUM
Async Semaphore
PREMIUMImplement an async semaphore that admits up to N concurrent holders and queues the rest until a permit frees.
25 minJavaScript - MEDIUM
Async Task Queue
PREMIUMImplement a task queue that runs async jobs under a concurrency limit and resolves an idle promise when drained.
25 minJavaScript - MEDIUM
Batch Event Flusher
Buffer events and flush them in batches when a size threshold or a max-wait timer is reached.
25 minJavaScript - MEDIUM
Cancellable Promise
PREMIUMWrap a promise so it can be cancelled — the wrapper rejects on cancel and ignores the underlying settlement.
25 minJavaScript - MEDIUM
Circuit Breaker
PREMIUMImplement a circuit breaker that trips open after repeated failures, rejects fast while open, then probes half-open.
25 minJavaScript - MEDIUM
ETag Revalidation Cache
Cache responses by URL and revalidate with an ETag, reusing cached data on a 304 Not Modified.
25 minJavaScript - MEDIUM
Form Validation Engine
Build a schema-driven form validator with composable per-field rules, cross-field checks, and async validators that report all errors.
30 minJavaScriptStripe · Atlassian · Airbnb - MEDIUM
HTTP Client Interceptors
PREMIUMBuild an axios-style client whose request and response interceptors transform each call as it passes through the chain.
25 minJavaScript - MEDIUM
Idempotency Key Queue
Dedupe by idempotency key: run a task at most once per key, cache the result with a TTL, and retry on failure.
35 minJavaScript - MEDIUM
Long-Polling Client
Build a long-polling loop that re-issues a held request as each returns, advances a cursor, backs off on error, and stops cleanly.
35 minJavaScript - MEDIUM
Map Async
Implement a function that applies an async mapper to every item in an array and resolves with the results.
25 minJavaScript - MEDIUM
Microtask Batch Scheduler
Coalesce all schedule calls made in one synchronous frame into a single flush on the next microtask.
25 minJavaScript - MEDIUM
Online/Offline Flush Manager
Queue writes while offline and flush them in FIFO order when the network returns, retrying failures without dropping or reordering.
35 minJavaScript - MEDIUM
Poll Until
Implement pollUntil — call an async function on an interval until a predicate passes or a timeout elapses.
25 minJavaScript - MEDIUM
Priority Request Scheduler
PREMIUMSchedule async requests under a concurrency limit, always running the highest-priority waiter next with a stable FIFO tiebreak.
35 minJavaScript - MEDIUM
Promise Merge
Implement a function that combines the results of two promises into a single value using a merger function.
25 minJavaScript - MEDIUM
Promise Pool
Implement a promise pool that runs task factories with a concurrency cap and resolves to their results in order.
25 minJavaScript - MEDIUM
Promise Timeout
Implement a function that races a promise against a timer and rejects if the promise doesn't settle in time.
25 minJavaScript - MEDIUM
Promise.all
Implement Promise.all so it resolves with an array of results or rejects on the first rejection.
25 minJavaScript - MEDIUM
Promise.any
PREMIUMImplement Promise.any so it resolves with the first fulfilled value or rejects with an AggregateError.
25 minJavaScript - MEDIUM
Promisify
PREMIUMImplement a function that wraps a Node-style error-first callback function so it returns a promise.
25 minJavaScript - MEDIUM
Promisify II
PREMIUMExtend promisify so the wrapped function can override the resolved value via a custom override hook.
25 minJavaScript - MEDIUM
Reconnecting WebSocket
PREMIUMWrap a WebSocket so it auto-reconnects with exponential backoff, queues sends while down, and re-emits its events.
35 minJavaScript - MEDIUM
Resilient Fetch Wrapper
Wrap an async call with retries, backoff, and a per-attempt timeout so transient failures recover.
25 minJavaScript - MEDIUM
Retry with Backoff
Implement retry — re-run a failing async function with a delay that grows exponentially between attempts.
25 minJavaScript - MEDIUM
Singleflight
Implement singleflight so concurrent calls for the same key share one in-flight promise instead of duplicating work.
25 minJavaScript - MEDIUM
Stale-While-Revalidate Cache
PREMIUMReturn cached data instantly, serving stale values while revalidating them in the background.
25 minJavaScript - MEDIUM
Task Runner with Dependencies
Run async tasks in dependency order, executing independent ones in parallel and catching cycles.
30 minJavaScript - MEDIUM
Test Runner
Implement a minimal test runner that registers cases, runs each one, and reports pass and fail counts.
25 minJavaScript - MEDIUM
useAsync
Implement a hook that runs an async function and tracks its status, value, and error, with a manual execute trigger.
25 minJavaScript - MEDIUM
useAsyncRetry
Implement an async hook that exposes a retry function to re-run the last operation on demand.
25 minJavaScript - MEDIUM
useFetch
Implement a data-fetching hook exposing data, error, and loading, that refetches when the URL changes and ignores stale responses.
25 minJavaScript - MEDIUM
useQuery
Implement a hook that tracks the loading, data, and error states of a promise-returning request.
25 minJavaScript - HARD
async parallel / series
PREMIUMImplement Node-style async runners — run error-first tasks in parallel or in series and collect their results.
40 minJavaScript - HARD
Async Read-Write Lock
Implement a read-write lock that allows many concurrent readers or one exclusive writer without starving writers.
40 minJavaScript - HARD
Cooperative Scheduler
Run a queue of tasks in time slices, yielding control between them so the main thread stays responsive.
40 minJavaScript - HARD
DataLoader
PREMIUMBatch and cache load(key) calls made in one tick into a single batch function call, preserving order.
40 minJavaScript - HARD
Lazy Tree View
PREMIUMBuild a collapsible tree that lazily loads a node's children the first time it is expanded.
40 minUI / FrameworksAngularReactHTML / CSS / JSVue - HARD
Map Async Limit
PREMIUMImplement an async map that processes an array with a bounded number of in-flight tasks.
40 minJavaScript - HARD
Middlewares
PREMIUMImplement an async middleware composer that chains functions Koa-style, threading a shared context through next.
40 minJavaScript - HARD
Mini React Query Core
PREMIUMBuild a framework-agnostic query cache with request dedup, staleTime, subscribers, and invalidation.
40 minJavaScript - HARD
Observable
PREMIUMImplement a minimal Observable with subscribe/unsubscribe and of/from plus map and filter operators.
40 minJavaScript - HARD
Optimistic Mutation Manager
PREMIUMApply optimistic updates immediately and roll them back on failure, even with concurrent mutations.
40 minJavaScript - HARD
Realtime Search with Cache
PREMIUMBuild a search box that caches results per query and dedupes in-flight requests.
40 minUI / FrameworksAngularReactHTML / CSS / JSVue - HARD
Redux-Saga Effect Runner
PREMIUMBuild a redux-saga-style interpreter that runs a generator of declarative effects and resumes it with each result.
50 minJavaScript - HARD
RxJS-Lite Pipeable Operators
PREMIUMBuild a mini reactive-streams library: a cold Observable and pipeable operators composed with a .pipe() chain.
50 minJavaScript - HARD
Test Runner IV
PREMIUMExtend a tiny test runner so it correctly awaits asynchronous specs and asynchronous setup or cleanup hooks.
40 minJavaScript - HARD
useInfiniteScroll
PREMIUMImplement a hook that loads more pages when a sentinel element scrolls into view, guarding against duplicate loads.
40 minJavaScript - HARD
useSWR
PREMIUMImplement a stale-while-revalidate data hook with an in-memory cache, dedup, and revalidation shared across components.
40 minJavaScript - HARD
useWebSocket
PREMIUMImplement a WebSocket hook exposing connection status, last message, and send, with auto-reconnect and cleanup.
40 minJavaScript