race then or catch

https://dev.to/bhagatparwinder/promises-chaining-error-handling-operators-3ccb

JavaScript

const waitForMe = function (name, time) {
    return new Promise((resolve, reject) => {
        setTimeout(() => {
            return resolve(name);
        }, time);
    });
}

const firstPromise = waitForMe("Parwinder", 4000);
const secondPromise = waitForMe("Lauren", 3000);
const thirdPromise = waitForMe("Robert", 7000);
const fourthPromise = waitForMe("Eliu", 5000);

Promise.race([firstPromise, secondPromise, thirdPromise, fourthPromise])
    .then((data) => {
    		console.log("inside then")
        console.log(data);
    })
    .catch((error) => {
    		console.log("inside catch")
        console.log(error); // Lauren
    })