Refer to the code below:
Let car1 = new Promise((_, reject) =>
setTimeout(reject, 2000, “car 1 crashed in” =>
Let car2 =new Promise(resolve => setTimeout(resolve, 1500, “car 2 completed”)
Let car3 =new Promise(resolve =>setTimeout(resolve, 3000, “car 3 completed”)
Promise.race(( car1, car2, car3))
.then (value => (
Let result = ‘$(value) the race.’;)}
.catch(arr => {
console.log(“Race is cancelled.”, err);
});
What is the value of result when Promise.race executes?
A . Car3 completes the race
B . Car 2 completed the race.
C . Car 1 crashed in the race.
D . Race is cancelled.
Answer: B
Latest JavaScript Developer I Dumps Valid Version with 144 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund