so I am trying to execute my promises sequentially without using async below is my code
//promises is an array of function who return a promise
const p = function(promises){
let result = promises.reduce((prevPromise, promise) => {
return prevPromise.then(res => {
return promise.then(Array.prototype.concat.bind(res))
})
}, Promise.resolve([]));
return result;
}
now say promises array has 2 functions which execute in 5 and 10 secs respectively, above code is giving answer in 10 secs but if true sequence execution should give in 15 secs. Please suggest.