Sign in

A callback is a function sent as an argument to another function. The callback is executed when a particular task is completed or when an event occurs. It is a predecessor to promises. Promises, though perform the same functionality as callback, are ,much more easier to read and compact. Older modules use callbacks whereas, the newer ones work well with promises. This creates makes them difficult to work with each other. Also, the functional modules that use callbacks cannot be used with async/await. One of the ways to use callback functions in such scenarios, is to convert them to promises.

Swathi Bhat

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store