What is Callback Hell?
Callback Hell (also called "Pyramid of Doom") is a situation where callbacks are nested within callbacks multiple times, making code difficult to read, maintain, and debug.
Real-Life Example: Zomato App Workflow
1. Place Order
- User adds items to cart (Pizza, Biryani, Coke)
- Redirected to payment gateway
- After 3 seconds, payment is confirmed
- Order gets placed
2. Prepare Order
- Restaurant receives notification to start preparation
- After 3 seconds, food is prepared
- Token number is assigned for pickup
3. Pickup Order
- Delivery person gets notification
- Goes to restaurant location
- Picks up order using token number
4. Deliver Order
- Delivery person travels to customer location
- After 3 seconds, order is delivered successfully