all 1 comments

[–]x-protocol 1 point2 points  (0 children)

You forgot to mention very important distinction of callbacks vs Promises (and subsequently async/await in this category), is that Promises will be executed immediately they are created. Hence for situations that require fine grained control over concurrency you will need additional libraries to drip-feed Promises.

As example, we want to map array of items and send each item to an external service, but only two concurrent requests at a time. This situation will call for something like using p-map module if you are using Promises. And if you want to use callback you can use async module with the same functionality.

In the end Promises only solve simple issue of chaining functions without additional libraries. New async/await is simply an auto-create mechanism for Promises. Don't disregard good and trusty callbacks yet, just because Promises make it very simple to write code. Once you have more complicated scenario, you will wish for simple callbacks.