javascript
advanced
हल किया
2026-11-24 को समाप्त
Promise pool with a concurrency limit
Write runPool(tasks, limit) where tasks is an array of functions that each return a Promise. It runs the tasks with at most limit running at the same time and resolves to an array of results in the original order.
- Start a new task as soon as one finishes; don't wait for a whole batch.
- If any task rejects,
runPoolrejects with that error (tasks already running may finish). runPool([], 3)resolves to[].
Acceptance criteria
- No libraries; don't use
Promise.allon all tasks at once (that ignores the limit). - The tests use real timers; run the code and wait a moment for
All tests passed.
अब तक 0 लोगों ने हल किया।
एडिटरCtrl + Enter
जब टेस्ट "All tests passed" दिखाते हैं, तो चैलेंज इस ब्राउज़र में हल के रूप में चिह्नित हो जाता है।
अपना समाधान समीक्षा के लिए भेजें