Javascript – Reformat an object array by grouping by one common element
I have the following array: var a = [ { "box":"1", "product":"Pen", "color":"White" }, { "box":"1", "product":"Pencil", "color":"Blue" }, { "box":"1", "product":"Marker", "color":"Red" }, { "box":"2", "product":"Paper", "color":"White"}, { "box":"2", "product":"GlossPaper", "color":"Yello"}, { "box":"3", "product":"Eraser", "color":"Pink"} ]; I would like…