Promise vs setTimeout
<p>I've observed that in the following code:</p>

<pre><code>setTimeout(function(){console.log('setTimeout')});
Promise.resolve(1).then(function(){console.log('promise resolve')})
</code></pre>

<p>No matter how many times I execute this, the promise callback always logs before the setTimeout.</p>

<p>My understanding is that both callbacks are scheduled to be executed to the next tick, and I don't really understand what is going on that makes the promise always take precendence over the timeout.</p>