Yahoo India Web Search

Search results

  1. A Promise is an Object that links Producing code and Consuming code. JavaScript Promise Object. A Promise contains both the producing code and calls to the consuming code: Promise Syntax. let myPromise = new Promise (function(myResolve, myReject) { // "Producing Code" (May take some time) myResolve (); // when successful. myReject (); // when error

  2. Oct 7, 2024 · The Promise object represents the eventual completion (or failure) of an asynchronous operation and its resulting value. To learn about the way promises work and how you can use them, we advise you to read Using promises first. Description. A Promise is a proxy for a value not necessarily known when the promise is created.

  3. Oct 9, 2024 · What is a Promise? A promise in JavaScript is like a container for a future value. It is a way of saying, “I don’t have this value right now, but I will have it later.” Imagine you order a book online. You don’t get the book right away, but the store promises to send it to you.

    • 22 min
  4. Oct 7, 2024 · A Promise is an object representing the eventual completion or failure of an asynchronous operation. Since most people are consumers of already-created promises, this guide will explain consumption of returned promises before explaining how to create them.

  5. Nov 29, 2023 · Basically, a Promise object represents apending state” in the most common sense: the promise will eventually be fulfilled at a later date. To give you an illustration, suppose you want to buy a new phone to replace your old phone, so you open a messaging app to contact a phone store.

  6. Jul 25, 2024 · A promise is an object returned by an asynchronous function, which represents the current state of the operation. At the time the promise is returned to the caller, the operation often isn't finished, but the promise object provides methods to handle the eventual success or failure of the operation.

  7. People also ask

  8. Jun 23, 2024 · A promise is a special JavaScript object that links theproducing codeand theconsuming codetogether. In terms of our analogy: this is the “subscription list”. The “producing code” takes whatever time it needs to produce the promised result, and the “promise” makes that result available to all of the subscribed code when it’s ready.