I want to show the repeating building names as an array in the employee array below.
const employess = [
{
building_name: "A",
name: "John"
},
{
building_name: "B",
name: "John"
},
{
building_name: "A",
name: "Doe"
},
{
building_name: "c",
name: "John"
},
{
building_name: "B",
name: "Doe"
},
{
building_name: "C",
name: "David"
}
];
For example, I want to convert it to the following array format.
const employess = [
{
building_name: ["A", "B", "C"],
name: "John"
},
{
building_name: ["A", "B"],
name: "Doe"
},
{
building_name: ["C"],
name: "David"
}
]
Thank you very much in advance for your help.