Async/await functions in JavaScript
Async/await functions in JavaScript ES2017 (ES8) introduced the concept of async/await functions , and it’s the most important change introduced in this ECMAScript edition. Async functions are a combination of promises and generators to reduce the boilerplate around promises, and the “don’t break the chain” limitation of chaining promises. It’s a higher level abstraction over promises. When Promises were introduced in ES6, they were meant to solve a problem with asynchronous code, and they did, but over the 2 years that separated ES6 and ES8, it was clear that promises could not be the final solution . Promises were introduced to solve the famous callback hell problem, but they introduced complexity on their own, and syntax complexity. They were good primitives around which a better syntax could be exposed to the developers: enter async functions . Code making use of asynchronous functions can be written as function doSomethingAsync ( ) {...