Back to tasksGet help with live coding in real time with Sobes Copilot
Junior — Senior
24
Определение последовательности вывода в консоль
Task condition
Нужно выяснить, в каком порядке будут напечатаны значения в консоль, учитывая синхронные вызовы, микрозадачи (Promise.then, .catch) и макрозадачи (setTimeout).
console.log(1);
setTimeout(() => console.log(2));
Promise.reject(3)
.catch(console.log)
.then(() => console.log(7));
new Promise(resolve => setTimeout(resolve))
.then(() => console.log(4));
Promise.resolve(5)
.then(console.log)
.then(() => console.log(8));
console.log(6);