Région de recherche :

Date :

https://developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Promise

Promise - JavaScript | MDN - MDN Web Docs

The Promise() constructor is used to create the promise. The fulfillment of the promise is logged, via a fulfill callback set using p1.then(). A few logs show how the synchronous part of the method is decoupled from the asynchronous completion of the promise.

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. La méthode .then() prend deux arguments : le premier est une fonction de rappel ( callback ) pour le cas de résolution de la promesse et le second argument est une ...

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://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://masteringjs.io › tutorials › fundamentals › promise-create

JavaScript Create Promise - Mastering JS

In general, there are 4 ways to create a new promise in JavaScript: Using the Promise constructor. Using the static helpers Promise.resolve() and Promise.reject() Chaining with the then() function or catch() function. Call an async function.

https://javascript.info › promise-basics

Promise - The Modern JavaScript Tutorial

let promise = new Promise (function (resolve, reject) { // executor (the producing code, "singer") }); The function passed to new Promise is called the executor. When new Promise is created, the executor runs automatically. It contains the producing code which should eventually produce the result.

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.

https://dev.to › shriharimurali › javascript-promises-from-beginner-to-expert-a...

JavaScript Promises: From Beginner to Expert - DEV Community

Creating Promises. In this section, we will learn how to create promises from scratch. Creating a promise involves instantiating a new Promise object and passing a callback function with two parameters: resolve and reject. The resolve parameter is a function that is called when the asynchronous operation is successfully completed.

JavaScript Promises: From Beginner to Expert - DEV Community

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

Les promesses en JavaScript - Pierre Giraud

Les promesses en JavaScript - Pierre Giraud. Cours complet JavaScript. INTRODUCTION AU COURS JAVASCRIPT. Introduction au JavaScript. L’environnement de travail pour ce cours JavaScript. Où écrire le code JavaScript ? Commentaires, indentation et syntaxe de base en JavaScript. LES VARIABLES ET TYPES DE VALEURS JAVASCRIPT.

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

Understanding `new Promise` in JavaScript - Mastering JS

When you call `new Promise` in JavaScript, you invoke the Promise constructor. Here's how you can use the Promise constructor like a pro.