4 ms·
(assuming this is JavaScript): there's a difference between awaiting a promise, and just declaring a promise. Sometimes you want to declare a few promises firs
by rozenmd 2y ago
(assuming this is JavaScript): there's a difference between awaiting a promise, and just declaring a promise.
Sometimes you want to declare a few promises first, before running await Promise.all() - sometimes, you don't even care for the results of all of the promises, and just want the first result to complete (promise.race)
- ulrischa 2y agoThis is clear but in most cases I just don't care if it is a promise. If I need more control it is possible, but for the 99% cases I find it annoying writing await. This is also slowing down, because you need to know or look it up if the call returns a promise.
- beardyw 2y agoIn that case the promises are a waste of time because you always want to wait for them to complete. Very often you don't need to and your code will be quicker.