Group By Length

Array Methods ยท medium

Implement `groupByLength(words)` that groups an array of strings by their character length. Return an object where each key is a length and each value is an array of words with that length.

Hints
  • Use reduce with an object accumulator.
  • For each word, use its length as the key.

Learning resources

Loading...

Run your code to see results.