When a JavaScript developer tries to execute multiple asynchronous operations then sometimes issues arise and it is termed callback hell. 

Note: If you are a frontend developer with React.JS then these Top 20 React Questions will help you to crack your interviews easily.

How to escape from a callback hell?

JavaScript gives an easy way of avoiding callback hell. This is performed by event queue and promises.

  • Promises
  • Async/Await

Example of Callback Hell

getDataFromFunction1(function(x){
    getDataFromFunction2(x, function(y){
        getDataFromFunction3(y, function(z){
            ...
        });
    });
});

BY Best Interview Question ON 24 Aug 2022