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://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://developer.mozilla.org › fr › docs › Web › JavaScript › Reference › Global_Objects › Promise

Promise - JavaScript | MDN - MDN Web Docs

Renvoie un objet Promise qui est rompue avec la raison donnée. Promise.resolve(valeur) Renvoie un objet Promise qui est tenue (résolue) avec la valeur donnée.

https://stackoverflow.com › questions › 54723849

Why and when to use Promise.resolve? - Stack Overflow

Promise.resolve(value) is a convenience method that does new Promise(resolve => resolve(value). If the value is a promise it will be returned, if it is a promise from a userland promise library it will be converted to a native promise. If it is a plain value it will be converted for a promise fulfilled with that value.

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.

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));

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

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://fr.javascript.info › promise-basics

Promesse (promise) - JavaScript

let promise = new Promise(function(resolve, reject) { // L'exécuteur (le code produit, le "chanteur") }); La fonction passée à new Promise est appelée l’ exécuteur. Quand new Promise est créée, elle est lancée automatiquement. Elle contient le producteur de code, qui doit produire un résulat final.