As a newcomer to Angular and JavaScript, I am attempting to combine values with the same ID into one row using concatenation.
var array = [{
id: "410",
value: "val1"
}, {
id: "411",
value: "val1"
}, {
id: "412",
value: "val4"
},{
id: "410",
value: "val2"];
var output = [];
I hope for the desired output to look like this:
output = [
{id:"410", value:["val1","val2"]},
{id:"411", value:["val1"]},
{"id":412,value:["val4"]}]
Any assistance on achieving this would be greatly appreciated. Thank you in advance.