JS Coding Questions Logo
JS Coding Questions
#94💼 Interview

What are the pros and cons of promises over callbacks

Advertisement

728x90

Below are the list of pros and cons of promises over callbacks,

Pros:

1. It avoids callback hell which is unreadable

2. Easy to write sequential asynchronous code with .then()

3. Easy to write parallel asynchronous code with Promise.all()

4. Solves some of the common problems of callbacks(call the callback too late, too early, many times and swallow errors/exceptions)

Cons:

5. It makes little complex code

6. You need to load a polyfill if ES6 is not supported

Advertisement

Responsive Ad
🎯 Practice NowRelated Challenge

JavaScript Coding Exercise 9

Test your knowledge with this interactive coding challenge.

Start Coding

Advertisement

728x90
94of476
What are the pros and cons of promises over callbacks | JSCodingQuestions.com