Recall & Review
beginner
What problem do promises solve in JavaScript?
Promises help manage asynchronous operations by avoiding callback hell and making code easier to read and maintain.
Click to reveal answer
beginner
How do promises improve code readability?
Promises allow chaining with
.then() and .catch(), which makes asynchronous code look more like synchronous code.Click to reveal answer
beginner
What are the three states of a promise?
A promise can be pending (waiting), fulfilled (success), or rejected (error).
Click to reveal answer
beginner
Why is callback hell a problem?
Callback hell happens when callbacks are nested deeply, making code hard to read, debug, and maintain.
Click to reveal answer
beginner
How do promises handle errors better than callbacks?
Promises use
.catch() to handle errors in one place, avoiding scattered error handling in nested callbacks.Click to reveal answer
What does a promise represent in JavaScript?
✗ Incorrect
A promise represents a value that might not be ready yet but will be resolved in the future.
Which method is used to handle a successful promise result?
✗ Incorrect
.then() is used to handle the successful completion of a promise.What state is a promise in before it is fulfilled or rejected?
✗ Incorrect
A promise starts in the pending state before it is either fulfilled or rejected.
How do promises help avoid callback hell?
✗ Incorrect
Promises allow chaining with
.then(), making asynchronous code easier to read and avoiding deeply nested callbacks.Which method is used to catch errors in promises?
✗ Incorrect
.catch() is used to handle errors in promise chains.Explain why promises are used in JavaScript and how they improve asynchronous code.
Think about how promises make waiting for data easier and cleaner.
You got /4 concepts.
Describe the three states of a promise and what each means.
Consider what happens from start to finish of a promise.
You got /3 concepts.