Skip to main content

Practice · 2 of 3

Keyed Group-By

CHALLENGE
Difficulty: intermediate+25 XP

Write groupBy(items, keyFn) RETURNing an object mapping each key to the array of items with that key (order preserved within groups). Write keyCount(groups) that takes the result and returns the number of distinct keys.

Back to lesson: Practice: Generics — Practice