Sobes.tech
Junior — Senior

Determining the output sequence in the console (task 3)

livecode

Task condition

Specify the order and the values that will appear in the console when executing the following code:

const myPromise = new Promise((resolve) => {
  console.log(1);
  setTimeout(() => {
    console.log("timerStart");
    resolve("success");
    console.log("timerEnd");
  }, 0);
  console.log(2);
});

myPromise.then((res) => {
  console.log(res);
});

console.log(4);