UNPKG

@stewartmac/lotide

Version:

Modular collection of functions that operate on data, namely Arrays and Objects.

15 lines (14 loc) 327 B
const countLetters = function(inputString) { const charCount = {}; for (let character of inputString) { if (character !== ' ') { if (charCount[character]) { charCount[character] += 1; } else { charCount[character] = 1; } } } return charCount; }; module.exports = countLetters;