Skip to main content

Practice ยท 1 of 2

Group and Sum with reduce

Given orders (an array of { user, total } objects, already declared in the boilerplate), write sumByUser(orders) that RETURNS an object mapping each user to the sum of their totals. Use reduce โ€” no for loops.

Difficulty: intermediate

Back to lesson: Practice: Transforming Data โ€” Practice