DEV Community

Discussion on: Javascript fetch, retry upon failure.

Collapse
 
raneshu profile image
Ranesh • Edited

In the last line, do we really need to return await ...? i.e.

return await fetch_retry(url, options, n - 1);

?

Can we simply

return fetch_retry(url, options, n - 1);

?

Collapse
 
ycmjason profile image
YCM Jason

You can omit the await. I like putting await because it reminds me that I am dealing with async functions and direct values instead of Promises. Although async/await are just playing with promises at the end of the day.