const asyncTask = function(i) {
return new Promise((resolve, reject) => {
setTimeout(() => resolve(`Completing ${i}`), 100*i)
});
}
const promises = [
asyncTask(3),
asyncTask(1),
asyncTask(7),
asyncTask(2),
asyncTask(5),
];
asyncSeriesExecuter = async (promises)=> {
for(let i=0; i<promises.length; i++) {
await promises[i].then((data)=>{
console.log(data)
})
}
}
asyncSeriesExecuter(promises);