Ed

Network requests can fail. Good code retries with exponential backoff: waiting longer between each attempt. This is production-grade resilience!

Your Task:

  • Create retryWithBackoff(fn, retries, delay)
  • fn is an async function that might fail
  • Retry up to retries times
  • Wait delay ms, then delay * 2, then delay * 4...
  • Return result on success, throw after all retries fail
TypeScript Solution
Loading...

Submit your code to see test results