Last active
November 20, 2019 12:12
-
-
Save itaditya/55ab4f576a7260c07d4cae82fa181e57 to your computer and use it in GitHub Desktop.
Snippet for Avoiding the async/await hell medium article
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
(async () => { | |
const pizzaData = await getPizzaData() // async call | |
const drinkData = await getDrinkData() // async call | |
const chosenPizza = choosePizza() // sync call | |
const chosenDrink = chooseDrink() // sync call | |
await addPizzaToCart(chosenPizza) // async call | |
await addDrinkToCart(chosenDrink) // async call | |
orderItems() // async call | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment