List of questions
Related questions
Question 208 - Certified JavaScript Developer I discussion
Refer to the code below:
let car1 = new Promise((_ ,reject)=> setTimeout(reject,2000,"Car1 crashed in"));
let car2 = new Promise(resolve => setTimeout(resolve,1500,"Car2 completed"));
let car3 = new Promise(resolve => setTimeout(resolve,3000,"Car3 completed"));
Promise.race([car1,car2,car3])
.then(value=>{
let result = `${value} the race.`;
}).catch(err=>{
console.log('Race is cancelled.',err);
});
What is the value of result when promise.race execues?
A.
Car2 completed the race.
Your answer:
0 comments
Sorted by
Leave a comment first