const arr = [1,2,3,4,5,6]; const result = []; const fn = (item) => { let time = Math.ceil(Math.random()*1000) return new Promise(resolve => { setTimeout(() => { resolve(item) }, time); }) } arr.forEach(async (item) => { const val = await fn(item); result.push(val); console.log(result); }) forEach如何实现同步