functional-javascript-workshop
Version:
The basics of functional programming in JavaScript. No libraries required.
43 lines (28 loc) • 864 B
Markdown
Given an Array of strings, use `Array
```js
var inputWords = ['Apple', 'Banana', 'Apple', 'Durian', 'Durian', 'Durian']
console.log(countWords(inputWords))
// =>
// {
// Apple: 2,
// Banana: 1,
// Durian: 3
// }
```
* inputWords: An array of random Strings.
* Do not use any for/while loops or Array
* Do not create any unnecessary functions e.g. helpers.
* https://en.wikipedia.org/wiki/Reduce_(higher-order_function)
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce
```js
function countWords(inputWords) {
// SOLUTION GOES HERE
}
module.exports = countWords
```