0
I have an array with the following objects:
0: {nome: "Ricardo Graciolli", id: "2", atendimentos: "12", horario: "12:00"}
1: {nome: "Ana Paula Germano", id: "3", atendimentos: "12", horario: "07:00"}
2: {nome: "Ricardo Graciolli", id: "2", atendimentos: "15", horario: "07:00"}
And I would like a result that returns me an array more or less like this:
[{
nome: "Ricardo Graciolli",
id: "2",
horarios: [{
horario: "12:00",
atendimentos: "16"
}, {
horario: "07:00",
atendimentos: "12"
}]
},
{
nome: "Ana Paula Germano",
id: "3",
horarios: [{
horario: "07:00",
atendimentos: "12"
}]
}
]
I was going to edit the title just for that! The destructuring assignment was the way I was thinking to solve the problem, but there’s really no need. Your answer was exactly what I was looking for. Thank you very much!
– Paulo Monteiro