Promise.race
const result = Promise.race([
new Promise((resolve) => {
setTimeout(() => resolve("mk"), 2000)
}),
new Promise((resolve) => {
const data = fetch('https://dummyjson.com/RESOURCE/?delay=5000')
resolve(data)
})
])
result.then(res => console.log(res))