What do you mean by promise?
A Promise is an object which shows the result of the asynchronous operation. The result can be a resolved value or a reason why the process failed like “a network error occurred.
A promise can be any of the 3 states:-
- Pending - the promise’s result hasn’t yet been identified because the asynchronous operation has not been completed yet.
- Fulfilled - the asynchronous operation has completed, and the promise has now a resolved value.
- Rejected - the asynchronous operation has failed, and the promise has a reason that indicates why the process failed.