Skip to content

Commit a467439

Browse files
committed
created function
0 parents  commit a467439

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

countLetters.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
function countingLetters(object) {
2+
3+
object = object.split(" ").join("");
4+
object = object.split("");
5+
var letter = {};
6+
7+
for (var i = 0; i < object.length; i++) {
8+
if (letter[object[i]]) {
9+
letter[object[i]] += 1;
10+
11+
} else {
12+
letter[object[i]] = 1;
13+
}
14+
15+
}
16+
17+
return letter;
18+
19+
}
20+

0 commit comments

Comments
 (0)