Open this example in the interactive library
Source code
console.log(
await Promise.any([Promise.reject("failed"), Promise.resolve("ready")]),
);
Sample output
ready

Use the first successful task. A self-contained example using the JavaScript runtime.
Open this example in the interactive library
console.log(
await Promise.any([Promise.reject("failed"), Promise.resolve("ready")]),
);
ready