Async & Promises

Async Map with Concurrency Limit

hardJS SpecificJS / TS3 tests

Problem Statement

Implement `asyncParallelLimit(items, limit, asyncFn)`, which processes an array of items through an asynchronous function `asyncFn(item, index)` with at most `limit` tasks running concurrently. Results must be returned in the original order of items.

Examples

Example 1:
const fetchUser = async (id) => ({ id, name: 'User ' + id });
const users = await asyncParallelLimit([1, 2, 3, 4], 2, fetchUser);
// processes 2 at a time, returns results for 1, 2, 3, 4 in order
JavaScript & TypeScript starter code included
Run this as a live interview

Practice solo

3 test cases. No second person needed.

Get new interview exercises

Practice problems and review drills, sent when we publish new ones. No spam.

Unsubscribe anytime. We never share your address.