Région de recherche :

Date :

https://developer.mozilla.org › fr › docs › Web › JavaScript › Guide › Using_promises

Utiliser les promesses - JavaScript | MDN - MDN Web Docs

Une promesse est un objet (Promise) qui représente la complétion ou l'échec d'une opération asynchrone. La plupart du temps, on « consomme » des promesses et c'est donc ce que nous verrons dans la première partie de ce guide pour ensuite expliquer comment les créer.

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

Promise - JavaScript | MDN - MDN Web Docs

L'objet Promise (pour « promesse ») est utilisé pour réaliser des traitements de façon asynchrone. Une promesse représente une valeur qui peut être disponible maintenant, dans le futur voire jamais.

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 › en-US › docs › Web › JavaScript › Reference › Global_Objects › Promise

Promise - JavaScript | MDN - MDN Web Docs

Appends fulfillment and rejection handlers to the promise, and returns a new promise resolving to the return value of the called handler, or to its original settled value if the promise was not handled (i.e. if the relevant handler onFulfilled or onRejected is not a function).

https://www.freecodecamp.org › news › how-to-use-promises-in-javascript

Asynchronous JavaScript – How to Use Promises in Your JS Code

Promises are a powerful tool in JavaScript for managing asynchronous operations, providing a cleaner and more organized approach to handling asynchronous code. Here's what we'll cover: What is asynchronous JavaScript? The need for promises. What is callback hell? How to create a promise. How to consume promises with .then() and .catch()

Asynchronous JavaScript – How to Use Promises in Your JS Code

https://www.freecodecamp.org › news › javascript-promises-async-await-and-promise-methods

How to Use JavaScript Promises – Callbacks, Async/Await, and Promise ...

Promises are one of the most important parts of JavaScript – but they can be confusing and difficult to understand. Many new devs, as well as experienced ones, struggle to fully grasp them. So what is a promise? A promise represents an asynchronous operation whose result will come in the future.

How to Use JavaScript Promises – Callbacks, Async/Await, and Promise ...

https://javascript.info › promise-basics

Promise - The Modern JavaScript Tutorial

A Promise object serves as a link between the executor (the “producing code” or “singer”) and the consuming functions (the “fans”), which will receive the result or error. Consuming functions can be registered (subscribed) using the methods .then and .catch.

https://www.freecodecamp.org › news › guide-to-javascript-promises

How Promises Work in JavaScript – A Comprehensive Beginner's Guide

This article is an in-depth guide to promises in JavaScript. You are going to learn why JavaScript has promises, what a promise is, and how to work with it. You are also going to learn how to use async/await—a feature derived from promises—and what a job queue is. Here are the topics we will cover: Why should you care about promises?

How Promises Work in JavaScript – A Comprehensive Beginner's Guide

https://www.kodaps.dev › fr › blog › les-promesses-en-javascript

Les Promesses en Javascript - kodaps.dev

Une Promise comporte deux fonctions : then et catch. La fonction « then » prend en paramètre le résultat de la Promise, et renvoie une nouvelle promise. La fonction « catch » prend en paramètre l'erreur, et renvoie également une nouvelle promise.

https://medium.com › insiderengineering › mastering-javascript-promises-from-basics-to...

Mastering JavaScript Promises: From Basics to Advanced

A Promise is a JavaScript object used for managing asynchronous operations. Promises allow you to write code that continues after a specific event occurs without blocking the execution of other...

Mastering JavaScript Promises: From Basics to Advanced