+ 10
ASYNC JS: ES6 Promise.all method - unexpected output dilemma.
My question is about why there are two expected outputs from sololearn challenges in this chunk of ajax code but when I test in the debugger this gives me only [foo, car] as output? const a = new Promise((res, rej) => { //n1 Â Â Â Â setTimeout(() => res('foo'), 300); }); const b = new Promise((res, rej) =>Â Â { Â Â Â Â setInterval(() => rej('bar'), 100); Â Â Â Â res('car'); }); Promise.all([a, b]).then((race) => { Â Â Â Â console.log(race); }).catch((crash) => { Â Â Â Â console.log(crash); }); Right answers: [foo, car] ['bar', 'car'] - why this?
2 Answers
+ 11
I have not much idea about js promises but i can help you with this link..
https://stackoverflow.com/questions/55979096/ajax-promise-all-method-unexpected-output-dilemma
+ 8
DPP
Please donot spam.
https://www.sololearn.com/discuss/1316935/?ref=app