What is 'callback hell', and how do promises and async/await solve it?

JavaScript Async Basic Fresher1–2 Yrs Conceptual 1 min read

Quick Answer

Callback hell (“the pyramid of doom”) is deeply nested callbacks — each async step nested inside the previous one's callback — with error handling repeated at every level. Promises flatten it into a .then().then() chain with one .catch(); async/await makes it read like synchronous code with normal try/catch.

Callback hell is when you have several async operations that depend on each other, and each one's callback is nested inside the last, so the code marches off to the right and you're doing error handling at every single level. Promises fix the nesting — you chain .then calls at one level and put a single .catch at the end. Async/await goes further and lets you write it top to bottom like normal code with a regular try/catch, and it's all promises underneath.

  • Callbacks: no return value, no composition, errors passed as the first argument by convention ((err, data) => ...) and easy to forget.
  • Promises: a first-class object you can pass around, compose with Promise.all, and that has a single failure path.
  • async/await: the same promises underneath, just syntax that removes the nesting.