I have this array
var arr1 = [{id: 1, name: "lorem"}, {id: 1, name: "ipsum"}, {id: 2, name: "dolor"}]
as you can see here the first 2 indexs they got same id
, I want the ouput to be something like this
newArr
[
{
id: 1,
name: ["lorem", "ipsum"]
},
{
id: 2,
name: "dolor"
}
]