Skip to content
Advertisement

Then Vs Await issue

You dont have to read the code, what is happening is a file is being uploaded 1000 bytes at a time. And to ensure that we send the bytes in order we are using await. What if I wanted to use .then(), it seems hard as there is a loop around the fetch call.

JavaScript

Advertisement

Answer

Here is the same functionality without await. It replaces the for loop:

JavaScript
Advertisement