Région de recherche :

Date :

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

Promise.prototype.then() - JavaScript | MDN - MDN Web Docs

La méthode then(), disponible sur les instances Promise, prend jusqu'à deux arguments qui sont les fonctions de rappel respectivement utilisées pour la réussite ou l'échec de la promesse. Cette méthode renvoie immédiatement un objet Promise équivalent, ce qui permet d'enchaîner les appels aux autres méthodes des promesses.

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

JavaScript Promise then() Method - W3Schools

The then() method provides two callbacks: One funtion to run when a promise is fulfilled and one funtion to run when a promise is rejected.

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

Promise.prototype.then() - JavaScript | MDN - MDN Web Docs

The then() method of Promise instances takes up to two arguments: callback functions for the fulfilled and rejected cases of the Promise. It stores the callbacks within the promise it is called on and immediately returns another Promise object, allowing you to chain calls to other promise methods.

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

JavaScript Promises - W3Schools

Learn how to use JavaScript Promises to handle asynchronous code with then() method. See examples of promises for timeouts, files, and errors.

https://masteringjs.io › tutorials › fundamentals › then

The Promise then() Function in JavaScript - Mastering JS

Learn how to use the then() function to handle asynchronous operations with promises in JavaScript. See examples of then() with fulfilled, rejected, and chained promises, and how to use catch() as a shorthand for then().

The Promise then() Function in JavaScript - Mastering JS

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

Promesse (promise) - JavaScript

then (alors) Le plus important, le plus crucial est .then. La syntaxe est : promise.then( function(result) { /* gère un résultat correct */ }, function(error) { /* gère une erreur */ } ); Le premier argument de .then est une fonction qui se lance si la promesse est tenue, et reçoit le résultat.

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

Chaînage des promesses - JavaScript

Le prochain .then est appelé avec. Une erreur classique pour les débutants: techniquement, nous pouvons également ajouter plusieurs .then à une seule promesse. Ceci n’est pas le chaînage des promesses. Par example : let promise = new Promise(function(resolve, reject) { setTimeout(() => resolve(1), 1000); });

https://javascript.info › promise-basics

Promise - The Modern JavaScript Tutorial

The most important, fundamental one is .then. The syntax is: promise.then ( function (result) { /* handle a successful result */ }, function (error) { /* handle an error */ } ); The first argument of .then is a function that runs when the promise is resolved and receives the result.

https://www.pierre-giraud.com › javascript-apprendre-coder-cours › promesse-promise

Les promesses en JavaScript - Pierre Giraud

Exploiter le résultat d’une promesse avec les méthodes then() et catch() Pour obtenir et exploiter le résultat d’une promesse, on va généralement utiliser la méthode then() du constructeur Promise .