ES6 - Handle a Fulfilled Promise with then

Hello. In the following lesson about JavaScript Promises:

It says:

“The then method is executed immediately after your promise is fulfilled with resolve

I think this statement might be inaccurate, right? The then method is just executed when it is called. You can call .then() on a Promise before the Promise is fulfilled. The callback function passed to .then() won’t execute until the Promise is fulfilled, but .then() itself can execute before the promise resolves, right?

My understanding is that .then() adds the callback function passed to it to a queue of callbacks that are executed after the Promise is fulfilled.

Please let me know if there is something I am misunderstanding. Thanks in advance!

Sorry that should say “before the promise is fulfilled”, not “before the promise resolves”.

It’s likely just an oversimplification. But I think you are correct in saying that it isn’t a precise/correct explanation.

You can open an issue for it and see if we can come up with a better explanation that is still terse.

2 Likes

Thanks for the reply! Ok, just wanted to make sure my understanding is correct.

I opened an issue for it. Let see what feedback it gets.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.