Sobes.tech
Back to tasks
Junior — Senior
35

Определение последовательности вывода в console.log (пример 66)

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

Установите порядок, в котором будут напечатаны строки в консоль.

console.log('1');
setTimeout(() => {
    console.log('2');
});

new Promise((res, rej) => {
    console.log('3');
    res();
}).then(() => {
    console.log('4');
});

Promise.resolve().then(() => {
    console.log('5');
}).then(() => {
    console.log('6');
});

Promise.resolve().then(() => {
    console.log('7');
}).then(() => {
    console.log('8');
});