Lesson 32. Async functions
After reading lesson 32, you will be able to
- Write asynchronous code using a synchronous syntax
- Use generators to write asynchronous code
- Use asynchronous functions to write asynchronous code
One of the reasons JavaScript can be hard to learn is because of its asynchronous nature. Asynchronous code is hard to think about, but it’s this asynchronous nature that makes JavaScript such a great language for the web. Web applications are full of asynchronous actions—from loading assets to handling user input. The purpose of asynchronous functions is to make it easy to write and think about asynchronous code.
So far in this unit we’ve been dealing with promises, which have proven to be much more ...
Get Get Programming with JavaScript Next now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.