Région de recherche :

Date :

https://stackoverflow.com › questions › 29516390

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

pixelbits' answer is correct, and you should always use .then() to access the value of a promise in production code. However, there is a way to access the promise's value directly after it has been resolved by using the following unsupported internal Node.js binding: process.binding('util').getPromiseDetails(myPromise)[1]

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

It's really important to note that the Promise object doesn't return a value, it resolves a value via the then() method. It is the fetch() function that returns a value, which is a Promise instance.

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

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://stackoverflow.com › questions › 36911241

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

It is easy! Just set a variable (or create a function) that can access the value inside your async or promise code and store the value in an outside variable, object, array, etc you can check on. Here is a primitive example: // I just created a simple global variable to store my promise message. var myDelayedData = ''; // This ...

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.

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://developer.mozilla.org › en-US › docs › Web › JavaScript › Guide › Using_promises

Using promises - JavaScript | MDN - MDN Web Docs

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.

https://www.w3schools.com › jsref › jsref_promise_resolve.asp

JavaScript Promise.resolve() Method - W3Schools

The Promise.resolve() method returns a Promise object resolved with a value. Syntax. Promise.resolve (message) Parameters. Return Value. Promise Tutorial. catch () finally () then () Browser Support. Promise.Resolve() is an ECMAScript6 (ES6) feature. ES6 (JavaScript 2015) is supported in all modern browsers since June 2017:

https://www.freecodecamp.org › news › the-javascript-promises-handbook

How JavaScript Promises Work – Handbook for Beginners - freeCodeCamp.org

Joe Attardi. Many operations, such as network requests, are asynchronous in nature. One of the most useful and powerful tools for working with asynchronous code is the Promise. In this handbook, you'll learn all about JavaScript Promises and how to use them. Table of Contents. What is a Promise? Comparing Promises to Other Async Patterns.

How JavaScript Promises Work – Handbook for Beginners - freeCodeCamp.org

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.