← Practice
Async·hard 30 min 120 XP

Async Retry

Write retry(fn, attempts) that calls fn() (which returns a Promise), retrying on rejection up to `attempts` total tries before finally rejecting.

Examples

  • retry(flakyFn, 3) tries flakyFn up to 3 times before giving up

Constraints

  • Keep the required function name so the tests can find it
  • Return a value instead of only logging it
  • Do not mutate inputs unless the challenge asks you to
Async Retry · editor

Code runs in an isolated Web Worker with a 3-second timeout — no DOM access, and it can never hang the page.