Sobes.tech
Back to tasks
Junior — Senior
47

Определение порядка вывода в консоль

Companies where asked:

IT OneIT One
Get help with live coding in real time with Sobes Copilot
Task condition

Укажите, какой порядок будет напечатан в консоль при выполнении следующего кода:

setTimeout(() => {
    console.log("timeOut");
}, 0);

console.log(1);

new Promise(resolve => {
    console.log("Promise");
    setTimeout(() => {
        console.log("777");
        resolve();
    }, 0);
}).then(() => {
    setTimeout(() => {
        console.log("then1");
    }, 0);
}).then(() => {
    console.log("then2");
});

console.log(4);

setTimeout(() => {
    console.log("timeOut2");
}, 0);