$ ./guess_the_languageProblem Solving — fix the bug
Problem Solving — fix the bug · hard · #192

Which fix removes the bug?

const [a, b] = await Promise.all([one(), two()]);
// two() rejects, one() keeps running
  1. Use allSettled and check
  2. Await the calls in order
  3. Wrap each in a timeout
  4. Return early on reject
Promise.all rejects on the first failure and leaves the other work unhandled and unreported.
Play Problem Solving ▸