
Promises chaining - The Modern JavaScript Tutorial
Apr 6, 2023 · Promises provide a couple of recipes to do that. In this chapter we cover promise chaining. It looks like this:
Error handling with promises - The Modern JavaScript Tutorial
Jun 18, 2022 · new Promise(function() { noSuchFunction(); // Error here (no such function) }) .then(() => { // successful promise handlers, one or more }); // without .catch at the end! In …
Promise: then versus catch - The Modern JavaScript Tutorial
promise .then(f1, f2); That’s because an error is passed down the chain, and in the second code piece there’s no chain below f1 . In other words, .then passes results/errors to the next …
Promises chaining - JavaScript
Dec 15, 2021 · fetch('/article/promise-chaining/user.json') .then(response => response.json()) .then(user => fetch(`https://api.github.com/users/${user.name}`)) .then(response => …
الوعود Promises chaining - JavaScript
fetch('/article/promise-chaining/user.json') .then(response => response.json()) .then(user => fetch(`https://api.github.com/users/${user.name}`)) .then(response => response.json()) // هنا …
Microtasks and event loop - JavaScript
Promise handling is always asynchronous, as all promise actions pass through the internal “promise jobs” queue, also called “microtask queue” (v8 term). So, .then/catch/finally handlers …
Concatenamento di promise (promise chaining) - JavaScript
Apr 30, 2022 · Tutti i .then sulla stessa promise ricevono lo stesso risultato – il risultato della promise. Così nel codice sopra tutti gli alert mostrano lo stesso: 1. Nella pratica raramente …
Promise Zinciri - JavaScript
fetch('/article/promise-chaining/user.json') .then(response => response.json()) .then(user => fetch(`https://api.github.com/users/${user.name}`)) .then(response => response.json()) …
Rewrite using async/await - The Modern JavaScript Tutorial
Rewrite this example code from the chapter Promises chaining using async/await instead of .then/catch: function loadJson(url) { return fetch(url) .then(response => { if (response.status == …
Promise 链 - JavaScript
Aug 31, 2022 · 当处理程序返回一个值时,它将成为该 promise 的 result,所以将使用它调用下一个 .then。 新手常犯的一个经典错误:从技术上讲,我们也可以将多个 .then 添加到一个 …
- Some results have been removed