1. Promise.race的使用:
1 const promise1 = new Promise((resolve, reject) => { 2 setTimeout(resolve, 500, 'one'); 3 }); 4 const promise2 = new Promise((resolve, reject) => { 5 setTimeout(resolve, 100, 'two'); 6 }); 7 Promise.race([promise1, promise2]).then((value) => { 8 console.log(value); 9 }) 10 11 //输出结果:two
2. Promise.race的实现:
标签:promise1,resolve,const,race,Promise,promise2 From: https://www.cnblogs.com/icyyyy/p/16806004.html