Created
May 20, 2021 09:04
-
-
Save prakashsvmx/2f370d5d4433a6509742c1fc9a551c54 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function logInOrder(urls) { | |
// fetch all the URLs in parallel | |
const textPromises = urls.map(async url => { | |
const response = await fetch(url); | |
return response.text(); | |
}); | |
// log them in sequence | |
for (const textPromise of textPromises) { | |
console.log(await textPromise); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment