Last active
February 13, 2024 07:48
-
-
Save taniarascia/1aba40266c414814f06b0ec1c7597d87 to your computer and use it in GitHub Desktop.
async
This file contains 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
method1 = async () => { | |
const things = await getThings() | |
for (let thing of things) { | |
const stuff = await getStuffFromThing(thing) | |
console.log(stuff) // works | |
} | |
} | |
method2 = async () => { | |
const things = await getThings() | |
await Promise.all(things.map(async thing => { | |
const stuff = await getStuffFromThing(thing) | |
console.log(stuff) // works | |
})) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment