I'm a fan of Open Source and have a growing interest in serverless and edge computing. I'm not a big fan of spiders, but they're doing good work eating bugs. I also stream on Twitch.
In regards to the section “Awaiting multiple promises”, I would reword “Adding an await statement before your promises makes your code truly synchronous,” as it’s not correct. The await keyword allows you to write asynchronous code in a synchronous fashion, but the code running is still asynchronous. When there’s two awaits in a row, all that’s happening is the first asynchronous action is executed and when it’s complete (provided there's no error), only then does the next awaitable action run asynchronously as well.
When using Promise.all I prefer to destructure the results. I find it reads better, e.g. const [dog1Result, dog2Result] = await Promise.all([dog1, dog2]);
For those new to Promises, to complement the resource list in this post, I highly recommend practicing ES6 Katas over at es6katas.org. They have a great section on Promises.
Oh thank you so much, that's great feedback which I'll implement ASAP. Those katas are awesome by the way. I've been going at them for 30 minutes now and am just devouring them. I feel confident now 💪
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Arden, thanks for the writeup.
In regards to the section “Awaiting multiple promises”, I would reword “Adding an await statement before your promises makes your code truly synchronous,” as it’s not correct. The
await
keyword allows you to write asynchronous code in a synchronous fashion, but the code running is still asynchronous. When there’s twoawait
s in a row, all that’s happening is the first asynchronous action is executed and when it’s complete (provided there's no error), only then does the nextawait
able action run asynchronously as well.When using
Promise.all
I prefer to destructure the results. I find it reads better, e.g.const [dog1Result, dog2Result] = await Promise.all([dog1, dog2]);
For those new to Promises, to complement the resource list in this post, I highly recommend practicing ES6 Katas over at es6katas.org. They have a great section on Promises.
Oh thank you so much, that's great feedback which I'll implement ASAP. Those katas are awesome by the way. I've been going at them for 30 minutes now and am just devouring them. I feel confident now 💪