Skip to content

Instantly share code, notes, and snippets.

@taniarascia taniarascia/async.js
Last active Mar 20, 2019

Embed
What would you like to do?
async
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
You can’t perform that action at this time.