Data Visualization · Exercise 5 of 5 Previous
Advanced
Retry with backoff
withRetry(task, { tries, wait, sleep }) should call task(attempt), and after a failure wait wait, then 2 × wait, then 4 × wait, up to tries attempts. The last failure is thrown.
The starter waits a fixed time. Make the waits double. The page logs the waits it used.
What Check tests
- It succeeds on the third try
- The waits double: 100 then 200
- A task that always fails throws its last error
- The number of tries is respected
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Your page
Press Run to see the page.
Console
Nothing logged yet.