What is the output of the following code? - Promise Scheduling | Event Loop | JavaScript Quiz

@Devtools Tech

What would be the output of the following code snippet?

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);
Option 1
1 2 3 4 5 6 7
Option 2
1 7 3 5 4 2 6
Option 3
1 7 3 5 2 6 4
Option 4
1 2 6 4 3 5
Option 5
1 2 6 3 4 5
Do you see value in our efforts?

Devtools Tech is a free platform for Frontend Engineers. It takes a lot of time, effort, and finanical resources to keep the platform running. If you see any value in our work and would like to support us then you can do using the following options.

InternationalDomestic