function asyncPromise(value,timeout){ return new Promise(function(resolve,reject){ setTimeout(function(){ resolve(value); },timeout); }); } Promise.race([asyncPromise(2,2000),asyncPromise(1,1000),asyncPromise(3,4000)]) .then(res => { console.log(res); });