es6-promises 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you handle the fulfillment of a Promise?

A

call the Promise.then() method with a function that will handle the fulfillment value
p.then(onFulfilled[, onRejected]);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you handle the rejection of a Promise?

A
call the then() method with an argument of a function that will handle the res
or catch() method.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly