FrontEnd.ro logo
Funcții pe Array-uri / partea 2
let employees = [
  { name: "Alex", salary: 950 },
  { name: "Jon", salary: 1761 },
  { name: "Diana", salary: 1000 }
];

let salaryExpenses = employees.reduce((acc, current) => {
  return acc + current.salary;
}, 0);

console.log(salaryExpenses); // 3711