Esta es la estructura de mis datos.
const resourecesSalary = [[ { designationName: 'backend developer', departmentName: 'web development', salary: { monthly: 10000 } }, { designationName: 'frontend developer', departmentName: 'web development', salary: { monthly: 10000 } }, { designationName: 'sr seo strategist', departmentName: 'seo', salary: { monthly: 10000 } }, { designationName: 'seo strategist', departmentName: 'seo', salary: { monthly: 5000 } }, { designationName: 'account manager', departmentName: 'client servicing', salary: { monthly: 15000 } } ]
La idea que estoy tratando de implementar es que necesito generar el costo total del departamento a partir de los datos anteriores. Ejemplo
const departmentWiseCost =[{ departmentName:'web development', totalCost:20000 //added the salary of resources from web development department }, { departmentName:'seo' totalCost:15000 //added the salary of resources from seo department }, { departmentName:'client servicing' totalCost:15000 //added the salary of resources from client servicing department }]
Por favor, ayúdame a resolver esto ya que soy un principiante en la codificación.