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
You can try to modify the object inside the function called per iteration by _.groupBy func. Notice that the source array change his elements!
var res = _.groupBy(cars,(car)=>{ const makeValue=car.make; delete car.make; return makeValue; }) console.log(res); console.log(cars);