Skip to content

Instantly share code, notes, and snippets.

@itaditya
Last active November 20, 2019 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save itaditya/55ab4f576a7260c07d4cae82fa181e57 to your computer and use it in GitHub Desktop.
Save itaditya/55ab4f576a7260c07d4cae82fa181e57 to your computer and use it in GitHub Desktop.
Snippet for Avoiding the async/await hell medium article
(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