UNPKG
@ahsolo/lotide
Version:
latest (1.0.2)
1.0.2
1.0.1
1.0.0
lotide assignment for Lighthouse Labs coding bootcamp
github.com/ahSOLO/lotide
ahSOLO/lotide
@ahsolo/lotide
/
countLetters.js
10 lines
(9 loc)
•
238 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
const countLetters =
function
(sentence)
{ let
input
= sentence.split(
" "
).join(
""
); let
output
= {};
for
(let letter of
input
) {
output
[letter] = (
output
[letter] ||
0
) +
1
; }
return
output
; };
module
.exports = countLetters;