3 ms·
the whole blog-post seems a little constructed tbh - If I look at await doSomething(param) await doSomethingElse(param) the very first thing that comes to mind
by BillyTheKing 5y ago
the whole blog-post seems a little constructed tbh - If I look at
await doSomething(param)
await doSomethingElse(param)
the very first thing that comes to mind is that this can be very, very easily optimised by just doing await Promise.all([
doSomething(param),
doSomethingElse(param)
])
This is something I come across literally every day - why exactly would that be an argument against async/await? much so on the contrary, I find const myResult = await Promise.all([]) significantly more expressive, than Promise.all([]).then(doSomething)
Also, as others have already pointed out - async/await is just syntactic sugar around promises and can be used in addition to 'normal' promise syntax (as shown above)
- johnny22 5y agoOnce you're sure the operation doesn't need to happen serially I hope :)