Skip to content
Quiz · Asynchronous code · lesson 6 of 12

Quiz — a promise and setTimeout

What does the program print (lines separated by spaces)?

JavaScript
console.log(1);
setTimeout(() => {
    console.log(2);
}, 0);
Promise.resolve().then(() => {
    console.log(3);
});
console.log(4);

Subscribe to take the course

The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.

Sign in another way