DEV Community

Discussion on: 6 points you need to know about async/await in JavaScript

danielsan profile image
Daniel Santana

Iโ€™m not sure why the first block of code in the article uses promises like the old callback hell, but here it is the proper way to write that first block of code:

  .then( sortByToppings )
  .then( checkDeliveryOptions )
  .then( checkBirthdayGift )
  .then( sendToCustomer ); 

And, in my opinion, it looks better then the alternatives offered by the article, not mentioning the testability of it.

avalander profile image

Agree, I think promises are better that async/await when it comes to function composition.

yashints profile image
Yaser Adel Mehraban Author

That was a bad example, not to be used