javascript/word-count: Functional solution with 'reduce'