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:
fetchPizzas() .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.
Agree, I think promises are better that async/await when it comes to function composition.
async/await
That was a bad example, not to be used
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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:
And, in my opinion, it looks better then the alternatives offered by the article, not mentioning the testability of it.
Agree, I think promises are better that
async/awaitwhen it comes to function composition.That was a bad example, not to be used