![]() This is also the same for promises in JavaScript. Because promises can only be made for the future.Ī promise has 2 possible outcomes: it will either be kept when the time comes, or it won’t. When we make a promise in real life, it is a guarantee that we are going to do something in the future. What is a Promise?Ī promise in JavaScript is similar to a promise in real life. Prerequisite: To understand this article better, check out my other post about JavaScript Callbacks. But you'll find an overall introduction to what Promises are, explanations of terms like resolve, reject, and chaining, and a code example for creating and using Promises. Promises are a broad topic so I can't go into every detail in this article. Many people struggle with understanding how Promises work, so in this post I will try to explain them as simply as I can. Promises are one of the ways we can deal with asynchronous operations in JavaScript.
0 Comments
Leave a Reply. |