I need to get an array by combining objects with the same type - adding their weight ․․․
const arr = [ {type: "a", weight: 10}, {type: "b", weight: 15}, {type: "a", weight: 20},]
Expected result;
[ {type: "a", weight: 30}, {type: "b", weight: 15},]