Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

9
  • 4
    ECMAScript, 25.4.3.1 Promise(executor) -> Step 9 Commented Feb 8, 2017 at 16:49
  • It doesn't matter: if you need to enforce order of operations, do so explicitly. Different implementations will handle promises with slight differences in behavior (bluebird vs native map, for example). Commented Feb 8, 2017 at 16:52
  • 2
    This may help explain things: stackoverflow.com/questions/42031051/…. It covers a slightly more complicated situation (a promise within a promise), but definitely covers what is going on here, including what happens when a promise resolves before the .then() handlers are attached. Commented Feb 8, 2017 at 17:41
  • 1
    Please don't close this question as a duplicate of one which only has bad answers. And no, this isn't implementation dependent but specified. Commented Sep 14, 2018 at 15:09
  • 1
    possible duplicate of Is the Promise constructor callback executed asynchronously? Commented Jul 27, 2019 at 16:42