Why promise.then() behaves asynchronously? : <p>In the below code why <code>promise.then()</code> behaves asynchronously. In other words , why browser is not waiting for the code written inside <code>promise.then()</code> method to be executed?.What tell the browser engine so that <code>promise.then()</code> makes an asynchronous call? </p>

<pre><code>const money = 500;

let promise = new Promise(function(resolve,reject){
    if(money &gt; 400){
        resolve('You have a car!');
    }else{
        reject('Yo do not have enough money to buy the Car!');
    }
});
console.log('Before');
promise.then(function(data){
    console.log('Success '+data);
});
console.log('After');
</code></pre>

<p>The above code prints the output in the below order, which means promise.then() works asynchronously.</p>

<ul>
<li>Before</li>
<li>After</li>
<li>Success You have a car!</li>
</ul>
