I am a believer of the Root Cause Analysis. Ask "How, What, Why" until you can dissect it with no further to go. Well, I am a frontend developer ready for new challenges!
Well picked examples. I got something similar to question 8 in one of the js interviews. Also, could you explain question 5 a little more in terms of the event loop? Why promise.all returns in the same order... wouldn’t the event loop resolve based on the settimeout delay once the promise is returned? Thanks
I am a believer of the Root Cause Analysis. Ask "How, What, Why" until you can dissect it with no further to go. Well, I am a frontend developer ready for new challenges!
I am a believer of the Root Cause Analysis. Ask "How, What, Why" until you can dissect it with no further to go. Well, I am a frontend developer ready for new challenges!
I am a believer of the Root Cause Analysis. Ask "How, What, Why" until you can dissect it with no further to go. Well, I am a frontend developer ready for new challenges!
I am a believer of the Root Cause Analysis. Ask "How, What, Why" until you can dissect it with no further to go. Well, I am a frontend developer ready for new challenges!
Well picked examples. I got something similar to question 8 in one of the js interviews. Also, could you explain question 5 a little more in terms of the event loop? Why promise.all returns in the same order... wouldn’t the event loop resolve based on the settimeout delay once the promise is returned? Thanks
Promise.all waits all promised to be resolved. That 's the simplest explanation
Yes. But my question is regarding the order of printing.
It also ensure the order of data from promises. More info here: developer.mozilla.org/en/docs/Web/...
Thank you for the reference. :)
the console.log is done only once after all promises are resolved, not for each timeout
Will not the print be in the order of resolution even if they are all printed after all the promises are resolved?
No, Promise.all takes an array off promisses and resolves to an array of all promise results in the same order. The array is what will be printed...
Okay!! this is the exact clarification I was looking for! Thank you! :)