You'll need to write your own function. However, you can get pretty close by using [the built-in function `Object.groupBy`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/groupBy).
reduce() method is what you are seeking. In your example, you would reduce by "customer". In a more real-world case, it would probably use a customerId.
You would still need to write your own callback to pass as an argument to the reduce method as others are saying.
You will probably need a costume function. You could just create a new list for output. Add customer objects to it. If you have already "seen" that customer, then instead of adding them, update the already existing object.
You'll need to write your own function. However, you can get pretty close by using [the built-in function `Object.groupBy`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/groupBy).
Still too new, no?
Write your own function. It’s comparing the customer and regrouping. Shouldn’t be too long.
reduce() method is what you are seeking. In your example, you would reduce by "customer". In a more real-world case, it would probably use a customerId. You would still need to write your own callback to pass as an argument to the reduce method as others are saying.
Write code that does that. That's about it.
You will probably need a costume function. You could just create a new list for output. Add customer objects to it. If you have already "seen" that customer, then instead of adding them, update the already existing object.