const a = new Promise((resolve, reject) => {
console.log("Promise a")
setTimeout(() => resolve('a is resolved'), 1000)
})
const b = new Promise((resolve, reject) => {
console.log("Promise b")
setTimeout(() => resolve('b is resolved'), 900)
})
// normally a and b would resolve in here but with c erroring
// nothing gets into the "then"
Promise.race([a, b]).then((winner) => {
console.log("race completed")
console.log(winner) // b is resolved a is ignored
}).catch((err) => {
console.warn(`error caught: ${err}`)
})