Something escapes me about the result of using async / await
async function firstAsync() {
let promise = new Promise((res, rej) => {
setTimeout(() => res("Now it's done!"), 1000)
});
let result = await promise;
console.log(result);
}
firstAsync();
console.log('toto')
The execution of the preceding example displays in the console:
toto
Now it's done!
This does not correspond at all to what should look like synchronous execution. In the case of synchronous execution the result should be
Now it's done!
toto
Did I miss something ?? Can someone explain to me what is going on?