This question already has an answer here:

I've been using Nodejs and I really dislike callbacks (as i think most people do.) I'm starting to learn about promises and generators. Both are a lot cleaner and I'd like to forget the horrors of callbacks all together and erase them from my memory.

Is there any reason I need to use callbacks. Can I completely abandon them and use promises or generators instead of them and never need to write another callback? Or do they have some use case where they are needed?

marked as duplicate by Bart van Ingen Schenau, user22815, GlenH7 Nov 13 '15 at 16:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 4
    Promises will be a lot, lot cleaner than plain callbacks. But, keep in mind that promises work via callbacks too, they just offer you a lot more functionality and structure for use with those callbacks. – jfriend00 Jun 11 '15 at 23:02
  • 1
    Could the reopen voter please leave a comment explaining why they believe this should be reopened? (I don't have anything against this question, I just honestly can't think of any reason to reopen it) – Ixrec Nov 15 '15 at 13:28

The short answer is yes, you can pretty much replace callbacks with promises. The caveat is some library APIs use callbacks so you are unlikely to be able to avoid them altogether.

Not the answer you're looking for? Browse other questions tagged or ask your own question.