Facebook Pixel

What happens if you call resolve twice on a promise in JavaScript?

The first resolve wins. The promise fulfills with the first value. The second resolve (and any subsequent resolve/reject) is ignored because the promise is already settled.

Verify This Answer

Cross-check this information using these trusted sources:

More FAQs in Promise States: Pending, Fulfilled, Rejected in JavaScript

Pending (initial, waiting for the operation to complete), fulfilled (operation succeeded, resolve was called), and rejected (operation failed, reject was called). A promise transitions from pending to fulfilled or rejected once.

No. A promise can only transition once: from pending to fulfilled or from pending to rejected. Once settled, it cannot change state. Subsequent resolve/reject calls are ignored.

Use Promise.resolve(value) for an already-fulfilled promise. Use Promise.reject(reason) for an already-rejected promise. These are settled immediately. .then/.catch still run (as microtasks).

Still have questions?

Browse all our FAQs or reach out to our support team

Want to upskill yourself?

Our courses are taking a Coffee break, but your curiosity shouldn't. Stay engaged with namastedev linkedin, youtube, discord and other resources while you wait.

0
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.