Promises Quiz Questions Flashcards
1
Q
What are the three states a Promise can be in?
A
pending: initial state, neither fulfilled nor rejected.
fulfilled: meaning that the operation was completed successfully.
rejected: meaning that the operation failed.
2
Q
How do you handle the fulfillment of a Promise?
A
with a callback function passed as an argument to the then method of the promise object
3
Q
How do you handle the rejection of a Promise?
A
with a callback function that is passed as an argument to the catch method of the promise object. Or passed as the second argument of the then method of the promise object