While chaining promises helps to create cleaner and more readable code, there is actually still room for improvement. Let's learn about the async and await keywords!
Understanding async/await and generators
Asynchronous code that looks synchronous
Since ES2015, ECMAScript has supported the creation of asynchronous functions. Asynchronous functions are marked as such using the async keyword and can be written as if they were synchronous. They make asynchronous code simpler to read and easier to reason about.
On the other hand, callers of asynchronous functions can wait for the result(s) of the calls instead of relying on separate event handlers and callback functions.
Async/await leverages promises and generators to avoid...