r/WebdevTutorials • • Dec 03 '20

What are callback functions in JavaScript and how to use them

https://jscurious.com/callback-functions-in-javascript/
44 Upvotes

4 comments sorted by

3

u/SweatyAnReady14 Dec 03 '20

Honest question. Is there any reason to use a callback over a Promise? Once I learned Promises I stopped finding the need to code callbacks.

3

u/amitav79 Dec 03 '20

Absolutely not. Promises are better way to write async code than callbacks. But before using Promises one should know the concept of callbacks and why to go for promises.

2

u/[deleted] Dec 03 '20

Now use observables!