A promise is pending while its asynchronous result is still unknown. This unresolved state lasts until the promise fulfills with a value or rejects with an error. section 6.3.2
A promise leaves the pending state in either of two ways:
- Calling resolve fulfills the promise with the promised value. section 6.3.2
- Calling reject, or encountering an unhandled exception during promise handling, rejects it. section 6.3.2
- Once fulfilled or rejected, a promise cannot switch to the other state. section 6.3.2
Waiting for a timeout
A promise that resolves after a 500-millisecond timeout remains pending while it waits. When the timeout calls resolve with “Hattori,” the promise fulfills. section 6.3.2
Use the state diagram to follow a promise from pending to either fulfilled or rejected. section 6.3.2


