const x = somethingAsync();
const y = somethingAsyncToo();
return { foo: await x, bar: await y }
There is no point in returning one before the other because you need both? const x = somethingAsync();
const y = somethingAsyncToo();
return { foo: await x, bar: await y }
There is no point in returning one before the other because you need both?You’re effectively saying that Promises are a better async programming paradigm than async/await…which is also what the author is saying in the article.
Both those promises start, and both are waited for after both have started..
That is the same as promise.all... There's just an explicit order for the wait, rather than as they resolve, but the result is the same.
Now, promise.any.... You'd have a point...
If the first await is the slowest, the second one will return immediately (like calling .then on an already resolved promise).
Exception handling is something completely different. Yes, if you call an async function and do not catch the exception, Node will stop. But that is independent of having called await or not. Whether or not you await something async does not affect exception behavior.