3 ms·
Well... mocha has support for callback since the beginning, callback is the simplest way to go, callback will never become obsolete, so there's really no need t
by chukye 9y ago
Well... mocha has support for callback since the beginning, callback is the simplest way to go, callback will never become obsolete, so there's really no need to use promises. :)
- mikewhy 9y agoPromises are the backbone of async/await.
- Akkuma 9y agoPeople should avoid using callbacks as they invert the chain of handling function calls. Rather than getting a result that you can work with, you move the logic into another function. Promises compose much more cleanly than callbacks do resulting in generally easier to follow code. If you call function x with a callback you either handle it immediately via your callback or you have to use some other paradigm to make it compose with other async code. You get no return value allowing you to write code that looks synchronous and forget about the beauty of async/await you've completed abandoned it with callbacks. If you use Promises you can do as you wish and combine them as you wish as they hold values and you can use them multiple times trivially with other Promises,
- eyko 9y agoBy the same reasoning, promises will never become obsolete because they're already supported. But if I were to bet on a hypothetical deprecation of one versus the other, I wouldn't bet on promises being deprecated, because they're part of the spec.