Learn to write async code in JavaScript
Here you can find some useful resources if you want to learn to write async
code in JavaScript. By learning to write async
code I mean to gain a basic understanding of the event loop, and how to use and write promises with the promise syntax or with async
/await
. You can also find some notes I wrote while reading, but I don’t know how useful they can be to you.
Learning to write asynchronous code takes time and effort. If you find yourself stuck at some point, and you feel you’re not making progress, first take a break. Then, find another resource that explains the topic you don’t understand, or revisit something you read previously—you’ll discover something you’ve missed on the first read.
I’m not sure who is this post for, but I can tell you how I felt before I started reading. I’ve used promises and async
/await
in my code before, but when things were complicated:
- I wasn’t 100% sure if I was using them correctly.
- I was observing some behavior that I couldn’t explain.
If that sounds familiar, you’ll find the resources recommended here valuable.
Topics
There are the posts with the notes:
I broke it in 3 parts because each topic deserves a separate page, and because I plan to add more resources in the future. As a result, one page won’t be enough. I may also add new pages for other asynchronous topics like generators or even callbacks. For now, these topics are under the “Further reading” section.
Further reading
Other things to read
Popular
- Reveal animations on scroll with react-spring
- Gatsby background image example
- Extremely fast loading with Gatsby and self-hosted fonts