Callback hell is a deeply nested structure created when asynchronous requests, user events, and DOM updates are handled inside successive callbacks. The code becomes difficult to follow and starts to resemble a horizontal pyramid, also called the “Christmas tree of doom.” section 8.1
Nested student requests
A request fetches students, sorts them, filters US records, fetches each student’s grades, averages them, and handles errors through nested success and error callbacks. The resulting indentation hides the actual sequence of operations.
Common symptoms include:
- Relying on spacing and indentation to make tangled control flow readable. section 8.1
- Creating closures that retain unnecessary outer variables. section 8.1
