Namaste JavaScript — Interview Quick Notes
Ep 20: Callback Problems
- Callback Hell (Pyramid of Doom): deeply nested callbacks that make code hard to read and maintain.
- Inversion of Control: passing a callback means trusting the callee to invoke it correctly — it may run 0 times, twice, or never.
1// Callback hell
2api.createOrder(cart, function () {
3 api.proceedToPayment(function () {
4 api.showOrderSummary(function () {
5 api.updateWallet()
6 })
7 })
8})