The other answer proves this, but let me talk about the reasoning:
Promise constructor
The promise constructor callback (as specified either in the ES6 spec or the constructor spec libraries implement) will always be executed synchronously - this is in order to extract a deferred (older form of promise construction) out of it in case you need to have access to the resolve callvackcallback:
var r; var p new Promise(function(resolve, reject){ r = resolve; }); // use r here, for example arr.push(r); then callbacks
then will always be executed asynchronously, virtually all mainstream promise implementations (Native, bluebird, $q, Q, when, rsvp, promise, jQuery (as of 3.0) etc) as well as native promises implement, or (or implement a superset (moreof, with more constraints) implement Promises/A+.
The reasonThis is exactly the reason that Promises/A+ was created out of Promises/A exactly for this reason. So that asynchronousAsynchronous guarantees will be preserved and Zalgo won't be released. (Also see this post).
The fact this happens (asynchronous guarnateeguarantee) is completely intentional and actively prevents race conditions. Code in- and outside of then will always execute in the same order.
Here is the relevant quote:
onFulfilled
onFulfilledor onRejectedonRejectedmust not be called until the execution context stack contains only platform code. [3.1].