Introduction

In the previous chapter, we saw how Promises are a huge improvement over the callback pattern. But we also saw that there were still some rough edges around composition. Creating promises directly takes different shape functions that are placed later in the chain. Errors and successful results were provided in different ways depending on how the Promise was created. And there is still be a bit of inconvenient nesting.

The async and await operators were introduced with ES8. These build on top of the Promise to make working with and creating Promises more seamless. In this chapter, we'll see how async and await can be used to create and work with promises in a more elegant way.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.145.150