Région de recherche :

Date :

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 › 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://www.w3schools.com › jsref › jsref_promise_resolve.asp

JavaScript Promise.resolve() Method - W3Schools

Description. 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.promisejs.org › api

API Reference - Promises

Returns a Promise that waits for all promises in the iterable to be fulfilled and is then fulfilled with an array of those resulting values (in the same order as the input). Show Example. var promise = Promise.resolve(3); Promise.all([true, promise]).then(values => { console.log(values); // [true, 3] . }); Show Polyfill.

https://masteringjs.io › tutorials › fundamentals › promise-resolve

Resolve a Promise in JavaScript - Mastering JS

The Promise.resolve() function is the most concise way to create a fulfilled promise that contains the given value. For example, suppose you wanted to create a promise that is fulfilled with the string 'Hello, World': const p = Promise.resolve('Hello, World'); const str = await p;

https://runebook.dev › fr › docs › javascript › global_objects › promise › resolve

JavaScript - Promise.resolve [fr] - Runebook.dev

Le Promise.resolve() static méthode "resolves" une valeur donnée à un Promise. Si la valeur est un promise , ce promise est renvoyé ; si la valeur est un thenable, Promise.resolve() appellera la méthode then() avec deux rappels préparés ; sinon le promise retourné sera rempli avec la valeur.

https://javascript.info › promise-chaining

Promises chaining - The Modern JavaScript Tutorial

When a handler returns a value, it becomes the result of that promise, so the next .then is called with it. A classic newbie error: technically we can also add many .then to a single promise. This is not chaining. For example: let promise = new Promise(function(resolve, reject) { setTimeout(() => resolve(1), 1000); }); .

https://www.freecodecamp.org › news › javascript-promise-tutorial-how-to-resolve-or-reject...

JavaScript Promise Tutorial – How to Resolve or Reject Promises in JS

Output the fastest promise that got resolved: The Promise.resolve/reject methods. Promise.resolve(value) – It resolves a promise with the value passed to it. It is the same as the following: let promise = new Promise (resolve => resolve(value)); Promise.reject(error) – It rejects a promise with the error passed to it. It is the same as the ...