Why do both Promise's then & catch callbacks get called?
<p>I have the following code and when it's executed, it returns both "<strong>rejected</strong>" and "<strong>success</strong>":</p>

<pre><code>// javascript promise
var promise = new Promise(function(resolve, reject){
  setTimeout(function(){reject()}, 1000)
});
promise
  .catch(function(){console.log('rejected')})
  .then(function(){console.log('success')});
</code></pre>

<p>Could anyone explain <strong>why success is logged?</strong></p>