Is there a way to group an array of objects by referring to certain value of the object in the array
let say I do have an array called
a=[
{name: "abc", address: "xxx"}
{name: "def", address: "yyy"}
{name: "xyz", address: "xyz"}
{name: "abc", address1: "123"}
{name: "def", address1: "456"}
]
I need to add the address of same name into one object and the new Array should look like as below
b =[
{name:"abc", address: "xxx", address1: "123"}
{name:"def", address: "yyy", address1: "456"}
{name: "xyz", address: "xyz"}
]
address1intended? I thought you wanted to merge two arrays of objects where the key isnameand you would want each address in the output merged array, suffixing each address withN(whereNis 1, 2, 3...). Am I mistaken?