A promise is an object that can be returned synchronously from an asynchronous function. It may be in the following three states:
Fulfilled : If a promise called the onFulfilled()
method, a promise will be in fulfilled state.
Rejected : If a promise called the onRejceted()
method, a promise will be in rejected state.
Pending : If a promise is not yet fulfilled or rejected, a promise will be in pending state.
A promise will be settled if and only if it is not pending.