What are the good parts of callbacks in JavaScript?
Simplicity (pass a function, it gets called later), universality (work everywhere), synchronous use (map, filter, reduce), event handling (addEventListener), and closures (access outer variables).
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in The Good and Bad Parts of Callbacks in JavaScript
Callback hell (deep nesting), inversion of control (trust the function to call correctly), repetitive error handling (each callback must check), hard to run in parallel (manual counter), hard to cancel, and unclear stack traces.
Use callbacks for simple one-off calls (setTimeout), event listeners, synchronous array methods (map, filter), and old codebases. Use promises/async-await for chained async operations, parallel operations (Promise.all), and complex error handling.
Yes. When you pass a callback, you give up control of when and how it is called. The function might call it multiple times, not at all, or with wrong arguments. Promises solve this by guaranteeing once-only settlement.
Still have questions?
Browse all our FAQs or reach out to our support team
