Sobes.tech
Junior — Senior

Determining the order of output to the console (example 72)

livecode

Task condition

Specify which values will appear in the console when executing the following JavaScript code:

const p = new Promise((resolve) => {
    console.log(1);
    setTimeout(() => {
        console.log(2);
        resolve();
    }, 0);
    console.log(3);
});

p.then(() => {
    console.log(4);
});