Does anyone know of a (lodash if possible too) way to group an array of objects by an object key then create a new array of objects based on the grouping? For example, I hav
Its also possible with a simple for loop:
for
const result = {}; for(const {make, model, year} of cars) { if(!result[make]) result[make] = []; result[make].push({ model, year }); }