Promises interview questions
Practice 32 questions on promises. Each runs in a real in-browser editor with Jest tests and a worked, diagram-backed solution.
32 questions
- JavaScriptCoding exercise
Async CountDown Latch
EASYImplement a countdown latch whose wait resolves once countDown has been called the required number of times.
15 minPractice - JavaScriptCoding exercise
Promise Waterfall
EASYRun async tasks in sequence, feeding each result into the next, stopping the chain on the first rejection.
15 minPractice - JavaScriptCoding exercise
Promise.race
EASYImplement Promise.race so it settles with the outcome of whichever input promise settles first.
15 minGoogle · RobloxPractice - JavaScriptCoding exercise
Promise.reject
EASYImplement a function that returns a Promise already rejected with the given reason.
15 minByteDance · Google · Meta +1Practice - JavaScriptCoding exercise
Sleep
EASYImplement a function that returns a promise resolving after the specified number of milliseconds.
15 minAmazon · LinkedIn · NetflixPractice - JavaScriptCoding exercise
Abortable Fetch with Timeout
MEDIUMFetch with a timeout that aborts the request via AbortController and honors an external abort signal.
25 minPremium questionPractice - JavaScriptCoding exercise
Array.fromAsync
MEDIUMImplement Array.fromAsync: build a promise of an array from a sync or async iterable, awaiting each value in order.
30 minPremium questionPractice - JavaScriptCoding exercise
Async Debounce (Latest Wins)
MEDIUMImplement an async debounce that resolves only the newest call and discards the results of superseded ones.
25 minPractice - JavaScriptCoding exercise
Async Mutex
MEDIUMImplement an async mutex whose acquire returns a release function, serializing access so only one holder runs at a time.
25 minPremium questionPractice - JavaScriptCoding exercise
Async Semaphore
MEDIUMImplement an async semaphore that admits up to N concurrent holders and queues the rest until a permit frees.
25 minPremium questionPractice - JavaScriptCoding exercise
Async Task Queue
MEDIUMImplement a task queue that runs async jobs under a concurrency limit and resolves an idle promise when drained.
25 minPremium questionPractice - JavaScriptCoding exercise
Cancellable Promise
MEDIUMWrap a promise so it can be cancelled — the wrapper rejects on cancel and ignores the underlying settlement.
25 minPremium questionPractice - JavaScriptCoding exercise
Map Async
MEDIUMImplement a function that applies an async mapper to every item in an array and resolves with the results.
25 minAnthropic · Apple · ByteDance +4Practice - JavaScriptCoding exercise
Microtask Batch Scheduler
MEDIUMCoalesce all schedule calls made in one synchronous frame into a single flush on the next microtask.
25 minPremium questionPractice - JavaScriptCoding exercise
Poll Until
MEDIUMImplement pollUntil — call an async function on an interval until a predicate passes or a timeout elapses.
25 minPractice - JavaScriptCoding exercise
Promise Merge
MEDIUMImplement a function that combines the results of two promises into a single value using a merger function.
25 minPractice - JavaScriptCoding exercise
Promise Pool
MEDIUMImplement a promise pool that runs task factories with a concurrency cap and resolves to their results in order.
25 minPractice - JavaScriptCoding exercise
Promise Timeout
MEDIUMImplement a function that races a promise against a timer and rejects if the promise doesn't settle in time.
25 minPractice - JavaScriptCoding exercise
Promise.all
MEDIUMImplement Promise.all so it resolves with an array of results or rejects on the first rejection.
25 minAmazon · Birdeye · ByteDance +13Practice - JavaScriptCoding exercise
Promise.allSettled
MEDIUMImplement Promise.allSettled from scratch, resolving to an array of fulfilled or rejected outcomes for each input.
25 minPractice - JavaScriptCoding exercise
Promise.any
MEDIUMImplement Promise.any so it resolves with the first fulfilled value or rejects with an AggregateError.
25 minPractice - JavaScriptCoding exercise
Promise.resolve
MEDIUMImplement Promise.resolve — wrap a value in a fulfilled promise, returning thenables unchanged and adopting their state.
25 minByteDance · Google · TikTokPractice - JavaScriptCoding exercise
Promise.withResolvers
MEDIUMImplement Promise.withResolvers — return a new promise alongside its external resolve and reject functions.
25 minMetaPractice - JavaScriptCoding exercise
Promisify
MEDIUMImplement a function that wraps a Node-style error-first callback function so it returns a promise.
25 minAmazon · MicrosoftPractice - JavaScriptCoding exercise
Promisify II
MEDIUMExtend promisify so the wrapped function can override the resolved value via a custom override hook.
25 minPremium questionAmazonPractice - JavaScriptCoding exercise
Retry with Backoff
MEDIUMImplement retry — re-run a failing async function with a delay that grows exponentially between attempts.
25 minPractice - JavaScriptCoding exercise
Singleflight
MEDIUMImplement singleflight so concurrent calls for the same key share one in-flight promise instead of duplicating work.
25 minPremium questionPractice - JavaScriptCoding exercise
useQuery
MEDIUMImplement a hook that tracks the loading, data, and error states of a promise-returning request.
25 minPractice - JavaScriptCoding exercise
async parallel / series
HARDImplement Node-style async runners — run error-first tasks in parallel or in series and collect their results.
40 minPremium questionPractice - JavaScriptCoding exercise
Async Read-Write Lock
HARDImplement a read-write lock that allows many concurrent readers or one exclusive writer without starving writers.
40 minPremium questionPractice - JavaScriptCoding exercise
Map Async Limit
HARDImplement an async map that processes an array with a bounded number of in-flight tasks.
40 minAdobe · Anthropic · Apple +7Practice - JavaScriptCoding exercise
Test Runner IV
HARDExtend a tiny test runner so it correctly awaits asynchronous specs and asynchronous setup or cleanup hooks.
40 minPremium questionMetaPractice