Promises to the rescue
ES6 introduces a new native pattern for writing the asynchronous code called as Promise pattern.
This new pattern removes the common code issues that the event and callback pattern had. It also makes the code look more like a synchronous code.
A Promise (or a Promise object) represents an asynchronous operation. The existing asynchronous JavaScript APIs are usually wrapped with Promises, and the new JavaScript APIs are being purely implemented using the Promises.
Promises are new in JavaScript but are already present in many other programming languages. Programming Languages such as C# 5, C++ 11, Swift, Scala, and more are some examples that support Promises.
ES6 provides the Promise API using which we can create Promises and ...
Get React: Building Modern Web Applications now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.