tezvyn:

How do you fetch from three APIs using Promise.all versus allSettled?

Source: developer.mozilla.orgintermediate

WHAT IT TESTS: Promise concurrency and failure isolation. ANSWER OUTLINE: Promise.all parallelizes but rejects on first failure. allSettled returns every outcome with status, value, and reason. RED FLAG: Wrapping each call in try-catch to imitate allSettled.

WHAT IT TESTS: Mastery of Promise concurrency, fault isolation, and graceful degradation strategies. ANSWER OUTLINE: Use Promise.all for parallel fetches, but it rejects immediately on the first failure and discards sibling results. Use Promise.allSettled to wait for every promise, yielding an array of outcome objects with status, value, and reason so you can degrade gracefully per component. RED FLAG: Recommending sequential awaits, manual per-promise try-catch wrappers, or conflating allSettled with Promise.race or Promise.any.

Read the original → developer.mozilla.org

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

How do you fetch from three APIs using Promise.all versus allSettled? · Tezvyn