There is a MDN spec Async function,refer function async function parallel() which I am trying to implement as part of a larger project for parallel processing ,but All my promises are not being generated or being resolved .Only one promise of the PromiseAll has gone "fulfilled" state(as seen in debugger).I am new student to JS and Promises.
console.log("==PARALLEL with await Promise.all==");
parallel();
// Definition of parallel function to Start 5 "jobs" in parallel and wait for both of them to complete
async function parallel() {
await Promise.all([
(async () => await a()),
(async () => await b()),
(async () => await c()),
(async () => await d()),
(async () => await e()),
]);
}
function a()
{
console.log("In function a ");
return Promise.resolve(1);
}
function b(){
console.log("In function b ");
return Promise.resolve(2);
}
function c(){
console.log("In function c ");
return Promise.resolve(3);
}
function d(){
console.log("In function d ");
return Promise.resolve(4);
}
function e(){
console.log("In function e ");
return Promise.resolve(5);
}
<div>Test Promises</div>