At this point, we should have a better understanding of the options we have to tame the asynchronous nature of JavaScript. Each one of the solutions presented has its own pros and cons. Let's summarize them in the following table:
Solutions |
Pros |
Cons |
---|---|---|
Plain JavaScript |
|
Might require extra code and relatively complex algorithms |
Async (library) |
|
|
Promises |
|
|
Generators |
|
|
Async await |
|
|
It is worth mentioning that we chose to present in this chapter only the most popular solutions to handle asynchronous control flow, or the ones receiving a lot of momentum, but it's good to know that there are a few more options you might want to look at, for example, Fibers
(https://npmjs.org/package/fibers) and Streamline
(https://npmjs.org/package/streamline).
3.14.144.216