1. What is the difference between synchronous and asynchronous functions?
Synchronous functions perform tasks sequentially, and cannot move on to the next task until the previous one is completed. Asynchronous functions, however, can initiate a task, and then put it aside for later while continuing to work on other tasks. For this reason, asynchronous code will not lock up the browser no matter how long it takes to complete.
2. What is callback hell?
Complex operations tend to require multiple levels of nested functions. Such code can become difficult for a human programmer to understand, and is thus known as âcallback hellâ.
3.Which technique can help us solve callback hell?
We can use âpromisesâ to help us solve callback hell. JQuery ships with a simple built-in promise library that enables us to chain callbacks and deal with errors.