FrontEnd.ro logo
Promise-uri în acțiune
Promise.allSettled([
  prepareFood("pizza"),
  prepareFood("burger")
])
  .then((results) => {
    results.forEach((result) => {
      if (result.status === 'fulfilled') {
        console.log(`${result.value} is ready. We can start eating it`);
      } else {
        console.log(`Unfortunately, we failed to prepare ${result.value}...`);
      }
    })
  });