Promises Settle Once
What you'll learn: Once a promise changes state (fulfilled or rejected), that state is permanent and cannot be changed.
The Immutable Settlement
When you create a promise and call resolve() or reject() in the executor function, the promise "settles" into that state forever. Any subsequent calls to resolve() or reject() are simply ignored by JavaScript. This is a core characteristic that makes promises reliable and predictable.
Think of it like sealing an envelope and dropping it in a mailbox. Once it's in, you can't un-mail it or change what's inside. The first settlement wins, period.
Why This Matters
const promise = new Promise((resolve, reject) => {
resolve('First result');
resolve('Second result'); // Ignored!
reject(new Error('Error')); // Also ignored!
});
promise.then(value => {
console.log(value); // Logs: "First result"
});
In this example, only the first resolve() call takes effect. The promise is now permanently fulfilled with 'First result'. The second resolve and the reject might as well not exist—JavaScript won't process them.
This behavior prevents race conditions and unpredictable state changes. You can trust that once you handle a promise's result (success or failure), that result won't suddenly change underneath you.
The Analogy
A promise is like a contest entry form. Once you submit it (settle it), the judges evaluate it and determine the outcome. You can't submit the same form again with different answers. The first submission is final.
Key Takeaway: A promise settles exactly once—the first call to resolve() or reject() locks in the state permanently, and all subsequent calls are silently ignored.