Région de recherche :

Date :

https://stackoverflow.com › questions › 29516390

javascript - How can I access the value of a promise? - Stack Overflow

Return a value → PromiseB is resolved immediately, and the value is passed to the success handler of promiseB. Return a promise → When resolved, promiseB will be resolved. When rejected, promiseB will be rejected. The value passed to the promiseB's then handler will be the result of the promise.

https://dev.to › ramonak › javascript-how-to-access-the-return-value-of-a-promise-object-1bck

Javascript: How to access the return value of a Promise object

Learn how to use the then () method or async / await syntax to get the result of a Promise object from a Fetch API or a custom load function. See examples, explanations and comments from other developers.

Javascript: How to access the return value of a Promise object

https://stackoverflow.com › questions › 36911241

javascript - How to extract data out of a Promise - Stack Overflow

While you can get a value from an awaited Promise inside an async function (simply because it pauses the function to await a result), you can't ever get a value directly "out" of a Promise and back into the same scope as the code that created the Promise itself.

https://developer.mozilla.org › ... › Web › JavaScript › Reference › Global_Objects › Promise › resolve

Promise.resolve() - JavaScript | MDN - MDN Web Docs

The Promise.resolve() static method "resolves" a given value to a Promise. If the value is a promise, that promise is returned; if the value is a thenable, Promise.resolve() will call the then() method with two callbacks it prepared; otherwise the returned promise will be fulfilled with the value.

https://bobbyhadz.com › blog › javascript-access-value-of-promise

How to access the Value of a Promise in JavaScript | bobbyhadz

Use the Promise.then() method to access the value of a promise. The then() method takes a function, which gets passed the resolved value of the promise as a parameter. index.js. // 👇️ Example promise const p = Promise.resolve('bobbyhadz.com');

https://developer.mozilla.org › fr › docs › Web › JavaScript › Guide › Using_promises

Utiliser les promesses - JavaScript | MDN - MDN Web Docs

Promise.resolve() et Promise.reject() sont des méthodes qui permettent de créer des promesses déjà tenues ou rompues. Promise.all() et Promise.race() sont deux outils de composition qui permettent de mener des opérations asynchrones en parallèle.

https://developer.mozilla.org › fr › docs › Web › JavaScript › Reference › Global_Objects › Promise

Promise - JavaScript | MDN - MDN Web Docs

Les méthodes promise.then(), promise.catch(), et promise.finally() sont utilisées pour associer une action ultérieure à une promesse lorsque celle-ci devient acquittée.

https://javascript.info › promise-api

Promise API - The Modern JavaScript Tutorial

The syntax is: let promise = Promise.all(iterable); Promise.all takes an iterable (usually, an array of promises) and returns a new promise. The new promise resolves when all listed promises are resolved, and the array of their results becomes its result.

https://fr.javascript.info › promise-basics

Promesse (promise) - JavaScript

Une promesse (promise) est un objet spécial en JavaScript qui lie le “producteur de code” et le “consommateur de code” ensemble. En comparant à notre analogie c’est la “liste d’abonnement”.

https://www.w3schools.com › Js › js_promise.asp

JavaScript Promises - W3Schools

Here is how to use a Promise: myPromise.then ( function (value) { /* code if successful */ }, function (error) { /* code if some error */ } ); Promise.then () takes two arguments, a callback for success and another for failure. Both are optional, so you can add a callback for success or failure only.