My codes:
let promise = new Promise(function(resolve, reject){
console.log('p');
resolve();
});
promise.then(()=>console.log('r'));
console.log('hi');
console.log('hi');
output:
p
hi
hi
r
I thought that fulfillment handler added to the queue before console.log('hi');
. It seems that I am wrong. Any hints? Thanks