FrontEnd.ro logo
Promise-uri în acțiune
Promise.all([
  prepareFood("pizza"),
  prepareFood("burger")
])
  .then(([pizza, burger]) => {
    console.log(`Finished everything. We have ${pizza} and ${burger}`);
  })
  .catch((firstReason) => {
    console.log(
      'Failed to prepare some food. Cancelling dinner',
      firstReason
    );
  });