Below is a helper function you can use to take an array and group by a key. const groupBy = function (data, key) { return data.reduce(function (carry, el) { var group = el[key]; if (carry[group] === undefined) { carry[group] = []} carry[group].push(el) return carry }, {})}export { groupBy} You can use this on your arrays by passing in your array with the key you want to group on. let array = [{ name: "Name 1", value: 15 }, { name: "Name 1", value: 30 }, { name: "Name 2", value: 45 }, { name: "Name 2", value: 70 }]console.log( groupBy(array, 'name')) This will output the new array as