Skip to main content

Practice ยท 2 of 3

Keyed Group-By

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.

Difficulty: intermediate

Back to lesson: Practice: Generics โ€” Practice