Let's dive into some examples to see how working with Promises in JavaScript looks and feels. We are not going to bore you with "this is how bad things were without Promises" examples. Since this guide primarily targets experienced JavaScript developers, we happily assume that you've written the kind of code we feature, without promises, and are well-familiar how that looked. If you are coming from another language - you probably don't care about the sad past, anyway. Either way - less is more, right?
A Summary Step After Parallel Steps
Let's demonstrate an example of running multiple async tasks in parallel and completing a summary step once all of them are finished.
Scenario:
1. Grab list of authors of a book from Google Books API
2. For each author, look up other books they have written. Make these calls in parallel, to save time
3. Once all parallel lookups are completed, output the final result.