复制1function runAsync (x) { 2 const p = new Promise(r => setTimeout(() => r(x, console.log(x)), 1000)) 3 return p 4} 5Promise.all([runAsync(1), runAsync(2), runAsync(3)]) 6 .then(res => console.log(res))
1function runAsync (x) { 2 const p = new Promise(r => setTimeout(() => r(x, console.log(x)), 1000)) 3 return p 4} 5Promise.all([runAsync(1), runAsync(2), runAsync(3)]) 6 .then(res => console.log(res))
题库维护不易,您的支持就是我们最大的动力!