Skip to content
Junior–Senior167 views

Determine the order of output to the console

Task condition

Specify the order in which messages will appear in the console when executing the following code:

 console.log(1);

setTimeout(() => console.log(2));

Promise.resolve().then(() => console.log(3));

Promise.resolve().then(() => setTimeout(() => console.log(4)));

Promise.resolve().then(() => console.log(5));

setTimeout(() => console.log(6));

console.log(7);
Frontend tasks in the code trainer