1

The spec says:

A resolved promise may be pending, fulfilled or rejected.

How can a Promise be resolved and pending?

Ben Aston
  • 53,718
  • 65
  • 205
  • 331
  • 4
    [What is the correct terminology for javascript promises](http://stackoverflow.com/questions/29268569/what-is-the-correct-terminology-for-javascript-promises#answer-29269515) – pishpish Apr 24 '17 at 16:24
  • 1
    resolved != fulfilled – Bergi Apr 24 '17 at 16:31
  • OK thanks. I get it. Resolution also covers the binding of an outer promise' state to that of an inner. Hence The outer promise can be pending (on an inner promise), and resolved. – Ben Aston Apr 24 '17 at 16:33

1 Answers1

4

It's right there in the section you linked to:

A promise is resolved if it is settled or if it has been “locked in” to match the state of another promise. [...]

That other promises might still be pending. Lets take a look at an example:

var p = new Promise(resolve => setTimeout(resolve, 1000));
var q = Promise.resolve(p);

// At this point `q` is resolved / "locked in"  but still pending
// because the `p` promise is also still pending.

// Only after the timeout has passed, the `p` promise will resolve/settle 
// and `q` will assume the inner promises state.

Looks like Bergi wrote a pretty comprehensive answer around promise terminology: What is the correct terminology for javascript promises

Community
  • 1
  • 1
Felix Kling
  • 795,719
  • 175
  • 1,089
  • 1,143
  • hi @Felix Kling, there `p` at the beginning is unresolved because it doesn't know if `resolve()` or `reject()` is going to be called and because it is not associated to another promise either, right? –  Mar 11 '23 at 19:39
  • 1
    @Coder23: That's right. – Felix Kling Mar 12 '23 at 22:26
  • Thank you @Felix Kling +1, I had doubts about the term *resolved*, but now I understand it. –  Mar 13 '23 at 01:26