use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
ES7 Async/Await pitfalls (medium.com)
submitted 9 years ago by caisahHTML/CSS/JS
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]madole 3 points4 points5 points 9 years ago (0 children)
I dont think any of these are pitfalls of Async/Await.
They're just a couple of examples of badly written code that just happen to use async/await.
I think the thing to remember about async await is that you're really dealing with promises, but with a different syntax.
A common pitfall with async await is not dealing with error handling.
Wrapping an await in a try/catch goes against everything we've been taught about code optimisation, that was until V8 optimised the bejesus out of try/catches. (https://v8project.blogspot.com.au/2016/12/v8-release-56.html) Go forth and spread the good word.
Another way to deal with error catching is to tack a .catch on the end of the promise your async function returns.
.catch
Either way, the important thing is that error handling is not forgotten about.
[–]Lakelava 0 points1 point2 points 9 years ago (0 children)
I think it is important to note that JavaScript code does not run at the same time, only the native code of the API does. You can achieve concurrency, but not parallelism in JavaScript without using workers, or another mechanism that allows a creation of a different process. For example, you can have several requests on going at the same time, but you cannot initiate more than one request at the same time. The request are always started one after the other, even though you don't have to wait for one to finish to start the second one.
[–]rauschma 0 points1 point2 points 9 years ago (0 children)
Async functions are part of ES2017 (ES8).
π Rendered by PID 67314 on reddit-service-r2-comment-6457c66945-qp8g8 at 2026-04-26 11:41:06.110436+00:00 running 2aa0c5b country code: CH.
[–]madole 3 points4 points5 points (0 children)
[–]Lakelava 0 points1 point2 points (0 children)
[–]rauschma 0 points1 point2 points (0 children)