Tip 43 Retrieve Data Asynchronously with Promises

In this tip, you’ll learn how to work with delayed data responses using promises.

JavaScript is an asynchronous language. That’s a big word for a simple concept. An asynchronous language is merely a language that can execute subsequent lines of code when previous lines of code aren’t fully resolved.

All right. Maybe that explanation wasn’t any more clear. Think about reasons why code may be blocked. You may be getting data from an API. You might be pulling data from the DOM or other source. You might be waiting for a user response. The common thread is you need some information to proceed, and it may take time to get it. If you want more examples, Peter Olson has a great breakdown of the differences ...

Get Simplifying JavaScript 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.