To handle multiple Promises concurrently and respond when the first one is fulfilled, use Promise._________.
- all()
- race()
- any()
- first()
The correct method is race(). It returns a promise that fulfills or rejects as soon as one of the promises in the iterable fulfills or rejects, with the value or reason from that promise. This is useful for handling scenarios where you want to respond to the first promise that resolves.
Loading...
Related Quiz
- Can a Symbol be used as an index in an Array?
- To process each element in an array and build a new array with elements that pass certain criteria, use _________.
- If you're building a function to fetch user data and then fetch related posts based on that data, how would you structure your Promise chain?
- Consider a situation where you have an array of user objects. How would you implement an iterator to selectively process only certain users?
- How do you import a specific function from a module in ES6?