2
I have the following code:
const execute = function() {
return new Promise((resolve, reject) => {
setTimeout(() => {
console.info('Iniciou');
resolve('Executando');
console.info('Finalizou');
}, 1000);
})
.then((data) => {
console.info(data);
})
.catch((err) => {
console.error(err);
});
};
execute();
As you can notice the execution of this code generates as output:
// Iniciou
// Finalizou
// Executando
I honestly have no idea why this should occur, if anyone can clear up this doubt.
Thank you for the reply.
– ThiagoO