JavaScript Demo: Promise.all()

Source: 
The Promise.all() method returns a single Promise that resolves when all of the promises passed as an iterable have resolved or when the iterable contains no promises. It rejects with the reason of the first promise that rejects.


var promise1 = Promise.resolve(3);
var promise2 = 42;
var promise3 = new Promise(function(resolve, reject) {
  setTimeout(resolve, 100, 'foo');
});

Promise.all([promise1, promise2, promise3]).then(function(values) {
  console.log(values);
});

// expected output: Array [3, 42, "foo"]

Không có nhận xét nào:

URL parameters with React Router

 https://ui.dev/react-router-url-parameters If you're reading this, you're probably familiar with the idea of function parameters. T...