Janji.race

// Promise.race()
// when you only want the result from the first
// resolved promise
//
//See video Tutorial: https://youtu.be/1cFl7WQDYYo

let p1 = Promise.reject(111);

let p2 = Promise.resolve(222);

let p3 = new Promise((resolve, reject)=>{
    setTimeout(resolve, 1000, 333);
});

Promise.race([p3, p2, p1])
    .then((result)=>{
        console.log('winning:', result);
})
    .catch((result)=>{
        console.log('Failed:', result);
})
Meandering Meerkat