asyncfunctionparallel() {constpromises= [a(),b(),c()];const [output1,output2,output3] =awaitPromise.all(promises);return`prallel is done: ${output1}${output2}${output3}`}parallel().then(console.log); // prallel is done: a b c
Sequence:
asyncfunctionsequence() {constoutput1=awaita();constoutput2=awaitb();constoutput3=awaitc();return`sequence is done ${output1}${output2}${output3}`}sequence().then(console.log); // sequence is done: a b c
Race:
asyncfunctionrace() {constpromises= [a(),b(),c()];constoutput1=awaitPromise.race(promises);return`race is done: ${output1}`;}race().then(console.log) // race is done: a