async function getResponse(index){ return new Promise((resolve,reject)=>{ setTimeout(()=>{ resolve(index) console.log(1000) },1000) }) } function serial(tasks){ let result = []; return tasks.reduce((accumulator,item,index)=>{ return accumulator.then(res=>{ return getResponse(item).then(res=>{ result[index] = res return index == tasks.length - 1 ? result : item }) }) },Promise.resolve()) } async function hha(){ const a = await serial([1,2,3,4]); console.log(a,'--aaaa---') } hha()