const calculateTeamFinanceReport = (salaries, team) => {
const res = { sumAllSalary: 0 };
for (const employee of team) {
if (!res.hasOwnProperty(employee.specialization)) {
res[employee.specialization] = salaries[employee.specialization].salary;
} else {
res[employee.specialization] += salaries[employee.specialization].salary;
}
res.sumAllSalary += salaries[employee.specialization].salary;
}
return res;
};
function countPositivesSumNegatives(input) {
// your code here
let positiveCount = 0;
let summOfNegativeCount = 0;
if (input.length === 0) {
return [];
}
input.forEach((el) => {
if (el > 0) {
positiveCount += 1;
}
if (el < 0) {
summOfNegativeCount -= -el;
}
});
return [positiveCount, summOfNegativeCount];
}