Région de recherche :

Date :

https://developer.mozilla.org › fr › docs › Web › JavaScript › Reference › Operators › await

await - JavaScript | MDN - MDN Web Docs

L'expression await interrompt l'exécution d'une fonction asynchrone et attend la résolution d'une promesse. Lorsque la promesse est résolue (tenue ou rompue), la valeur est renvoyée et l'exécution de la fonction asynchrone reprend.

https://developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Operators › await

await - JavaScript | MDN - MDN Web Docs

The await operator is used to wait for a Promise and get its fulfillment value. It can only be used inside an async function or at the top level of a module. Syntax. js. await expression. Parameters. expression. A Promise, a thenable object, or any value to wait for. Return value.

https://javascript.info › async-await

Async/await - The Modern JavaScript Tutorial

The keyword await makes JavaScript wait until that promise settles and returns its result. Here’s an example with a promise that resolves in 1 second: async function f() { let promise = new Promise((resolve, reject) => { setTimeout(() => resolve("done!"), 1000) }); let result = await promise; alert(result); // "done!" } f();

https://fr.javascript.info › async-await

Async/await - JavaScript

Le mot-clé await fait en sorte que JavaScript attende que cette promesse se réalise et renvoie son résultat. Voici un exemple avec une promesse qui se résout en 1 seconde: async function f() { let promise = new Promise((resolve, reject) => { setTimeout(() => resolve("done!"), 1000) }); let result = await promise; alert(result); // "done!"

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

JavaScript Async - W3Schools

The await keyword can only be used inside an async function. The await keyword makes the function pause the execution and wait for a resolved promise before it continues: let value = await promise;

https://developer.mozilla.org › ... › docs › Web › JavaScript › Reference › Statements › async_function

async function - JavaScript | MDN - MDN Web Docs

The async function declaration creates a binding of a new async function to a given name. The await keyword is permitted within the function body, enabling asynchronous, promise-based behavior to be written in a cleaner style and avoiding the need to explicitly configure promise chains.

https://www.pierre-giraud.com › javascript-apprendre-coder-cours › async-await

Utiliser async et await pour créer des promesses plus lisibles en ...

Les mots clefs async et await sont un sucre syntaxique ajouté au JavaScript pour nous permettre d’écrire du code asynchrone : ils n’ajoutent aucune fonctionnalité en soi mais fournissent une syntaxe plus intuitive et plus claire pour définir des fonctions asynchrones et utiliser des promesses.

Utiliser async et await pour créer des promesses plus lisibles en ...

https://www.freecodecamp.org › news › javascript-async-await

How to Use Async/Await in JavaScript – Explained with Code Examples

How async/await Works. The async/await syntax is a special syntax created to help you work with promise objects. It makes your code cleaner and clearer. When handling a Promise, you need to chain the call to the function or variable that returns a Promise using then/catch methods.

How to Use Async/Await in JavaScript – Explained with Code Examples

https://www.sitepoint.com › javascript-async-await

A Beginner’s Guide to JavaScript async/await, with Examples

The async and await keywords in JavaScript provide a modern syntax to help us handle asynchronous operations. In this tutorial, we’ll take an in-depth look at how to use async/await to master...

A Beginner’s Guide to JavaScript async/await, with Examples

https://stackoverflow.com › questions › 41697270

javascript - How to await an asynchronous function? - Stack Overflow

Await is used to wait for a promise resolving inside of async function. According to a mdn - async function can contain an await expression, that pauses the execution of the async function and waits for the passed promise's resolution, and then resumes the async function's execution and returns the resolved value.