What is Promises And Asyn-Await in Javascript
What is Promises And Asyn-Await in Javascript In this blog, you will learn about what Async/Await in javaScript, what it really is, and how it works behind the scenes. Before I start with Async/Await, I would suggest you understand what is Promises in JavaScript Because you need to understand Promises before you can understand how to use Async/Await Right Now you need to understand What is Promise in JavaScript A promise is an object that may produce a single property in the future or after some time. Either it will be a resolved value or a rejected value Promises are better for handling asynchronous operations in the Applications and they provide error handling better than callbacks functions. In other words, Promises makes JavaScript asynchronously, which makes this language versatile Working With Promises Let us understand promise with an example Suppose that you promised to lose 10 kgs of weight in the next two months Promises will have 3 possible states: Pending: You don