I have the following list:
nomes = [
{ nome: "flavio", valor: 10 },
{ nome: "flavio", valor: 20 },
{ nome: "fran", valor: 30 },
{ nome: "fran", valor: 40 },
{ nome: "Roberto", valor: 50},
{ nome: "Roberto", valor: 50 }
];
How do I get:
subtotais = [
{nome:"flavio", total:30},
{nome:"fran", total:70},
{nome:"Roberto", total:10}]
Thanks for any help.