Sobes.tech
Junior — Senior

What will be the output of Promise.race with different timeouts

livecode

Task condition

Determine what value will appear in the console after executing this code:

const p1 = new Promise((resolve) => setTimeout(resolve, 500, "1"));
const p2 = new Promise((resolve) => setTimeout(resolve, 100, "2"));

Promise.race([p1, p2]).then((result) =>
  console.log(result)
);