const countWords = str => str .toLowerCase() .split(/\s+/g) .reduce( (result, word) => ({ ...result, [word]: (result[word] || 0) + 1 }), {} )