FrontEnd.ro logo
Promise-uri în acțiune
Promise.resolve('Pizza')
  .then((food) => {
    console.log(`Eating ${food}`);
  });



Promise.reject(new Error('Restaurant closed for the weekend'))
  .catch((reason) => {
    console.log(`Damn it.`, reason);
  });