3 ms·
Author here: I actually tested this out after seeing someone else post the same solution, and it does run in parallel. Because the awaits don't come until after
by brundolf 6y ago
Author here: I actually tested this out after seeing someone else post the same solution, and it does run in parallel. Because the awaits don't come until after both requests have been created, the second request isn't blocked by the first.
Personally I agree that this is cleaner than the Promise.all() solution, but I also think it emphasizes just how misleading the syntax can be, given that those weighing in on this thread can't even agree what this code will do without trying it out.
- stormbrew 6y agoI'm personally surprised that people find this misleading? I mean, in so far as any programming construct is confusing until you understand it I can see it, but fundamentally if a promise could not progress until you waited on it, it would basically become impossible to write parallel code at all -- including implementing Promise.all().