Click in order · JavaScript and TypeScript course · Module 12: Functional Programming
Pipeline with reduce
Arrange the elements of array grouping with reduce:
Items to click
- data.reduce(
- ...groups,
- [item.key]: [...(groups[item.key] || []), item]
- }), {})
- (groups, item) => ({
You can check the correct answer by solving this task in the CodeWorlds game.