• Как слелать функцию подсчета?

    @skreeauk
    Без parseFloat:

    const calculateTeamFinanceReport = (salaries, team) =>
      team.reduce(
        (acc, cur) => {
          const total = Math.round(
            salaries[cur.specialization]?.salary *
              +`1.${salaries[cur.specialization]?.tax.replace("%", "")}`
          );
    
          if (!total) return acc;
    
          acc[`totalBudget$${cur.specialization}`] = !acc.hasOwnProperty(
            `totalBudget${cur.specialization}`
          )
            ? total
            : (acc[`totalBudget${cur.specialization}`] += total);
    
          acc.totalBudgetTeam += total;
          return acc;
        },
        { totalBudgetTeam: 0 }
      );
    Ответ написан
    Комментировать