What is callback hell?

Callback hell is where there are multiple nested callbacks.

This leads to very hard-to-read code. We have two ways to avoid this kind of callback hell :

Name your functions and declare them and pass just the name of the function as the call back, instead of defining an anonymous function in the parameter of the main function

Modularity: Separate your code into modules, so you can export a section of code that does a particular job. Then you can import that module into your larger application

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>