An asynchronous function is one where some external activity must complete before a result can be processed; it is “asynchronous” in the sense that there is an unpredictable amount of time before a result becomes available. Such functions require a callback function to handle errors and process the result.
See the following example:-
There are following techniques to avoid callback hell:-
- Using Async.js
- Using Promises
- Using Async-Await