ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 208 - Certified JavaScript Developer I discussion

Report
Export

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.
Answers
A.
Car2 completed the race.
Suggested answer: A
asked 23/09/2024
Lakshmana Mittadoddi
39 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first