I have an array which has different location and items.
[
{"location": "north", "items" : ["IT1", "IT2"]},
{"location": "south", "items" : ["IT1", "IT2"]},
{"location": "north", "items" : ["IT3", "IT4"]}
]
I want to remove duplicate location fields and append the items property from the duplicate to achieve this:
[
{"location": "north", "items" : ["IT1", "IT2", "IT3", "IT4"]},
{"location": "south", "items" : ["IT1", "IT2"]}
]
How can I do it with vanilla JS?