function handler(){
const results = [].map((item) => {
a();
b();
})
Promise.allSettled(results);
}
function a() {
// returns promise
}
function b() {
// returns promise
}
}
How to modify the above code so that I can pass array of promises to promise.allSettled(results)
I tried this but not sure if this is correct way?
function handler() {
const results = [].map((item) => {
const out1 = a();
const out2 = b();
return [...out1, ...out2];
})
Promise.allSettled(results);
}