Région de recherche :

Date :

https://developer.mozilla.org › en-US › docs › Web › JavaScript › Guide › Using_promises

Using promises - JavaScript | MDN - MDN Web Docs

A Promise is an object representing the eventual completion or failure of an asynchronous operation. Since most people are consumers of already-created promises, this guide will explain consumption of returned promises before explaining how to create them.

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

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

JavaScript introduced Promises as part of ES6 (ES2015) to solve this problem. It simplified working with callbacks and made for better syntax as you'll see shortly. Promises are now the foundation for most modern asynchronous operations developers use in JavaScript today.

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

https://www.freecodecamp.org › news › javascript-promise-object-explained

How JavaScript Promises Work – Tutorial for Beginners

How a Promise Works. Basically, a Promise object represents a “pending state” in the most common sense: the promise will eventually be fulfilled at a later date. To give you an illustration, suppose you want to buy a new phone to replace your old phone, so you open a messaging app to contact a phone store. This is similar to how ...

How JavaScript Promises Work – Tutorial for Beginners

https://www.freecodecamp.org › news › the-javascript-promises-handbook

How JavaScript Promises Work – Handbook for Beginners

Many operations, such as network requests, are asynchronous in nature. One of the most useful and powerful tools for working with asynchronous code is the Promise. In this handbook, you'll learn all about JavaScript Promises and how to use them.

How JavaScript Promises Work – Handbook for Beginners

https://www.w3schools.com › Js › js_promise.asp

JavaScript Promises - W3Schools

Promise How To. 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

The Promise object represents the eventual completion (or failure) of an asynchronous operation and its resulting value. To learn about the way promises work and how you can use them, we advise you to read Using promises first.

https://developer.mozilla.org › en-US › docs › Learn › JavaScript › Asynchronous › Promises

How to use promises - Learn web development | MDN - MDN Web Docs

A promise is an object returned by an asynchronous function, which represents the current state of the operation. At the time the promise is returned to the caller, the operation often isn't finished, but the promise object provides methods to handle the eventual success or failure of the operation.

https://javascript.info › promise-basics

Promise - The Modern JavaScript Tutorial

A promise is a special JavaScript object that links the “producing code” and the “consuming code” together. In terms of our analogy: this is the “subscription list”. The “producing code” takes whatever time it needs to produce the promised result, and the “promise” makes that result available to all of the subscribed code ...

https://web.dev › articles › promises

JavaScript Promises: an introduction | Articles - web.dev

JavaScript Promises: an introduction. bookmark_border. Promises simplify deferred and asynchronous computations. A promise represents an operation that hasn't completed yet. Jake Archibald. Developers, prepare yourself for a pivotal moment in the history of web development. [Drumroll begins] Promises have arrived in JavaScript!

https://javascript.info › promise-api

Promise API - The Modern JavaScript Tutorial

The syntax is: let promise = Promise.all(iterable); Promise.all takes an iterable (usually, an array of promises) and returns a new promise. The new promise resolves when all listed promises are resolved, and the array of their results becomes its result.