Question 15 of 5826%
15

In a modern browser, in what order will these labels be logged? The snippet compares microtask APIs with timer APIs on the main thread.

console.log("sync");

setTimeout(() => console.log("timeout"), 0);

const id = setInterval(() => {
  console.log("interval");
  clearInterval(id);
}, 0);

Promise.resolve().then(() => console.log("promise"));

queueMicrotask(() => console.log("micro"));

console.log("sync2");
15/58