What is the difference between synchronous and asynchronous functions?
Synchronous code is often read from top to bottom therefore code is executed in that order,this is considered synchronous programming .
Asynchronous programming is the process in which code is put to the side to be executed at a later time,such as after the synchronous code is executed.
What is callback hell?
Callback Hell, also known as Pyramid of Doom, is an anti-pattern seen in code of programmers who are not wise in the ways of asynchronous programming. … But once your project requirements start to swell, you will quickly find yourself piling layers of nested callbacks. Congrats! Welcome to Callback Hell.
- Which technique can help us solve callback hell?
Promises are a technique that call help control readability of indention problem that occurs when callback hell ensues. Promises are wrappers around asynchronous functions. Promises are an alternative to callbacks.