Skip to content

Commit 943e88e

Browse files
committed
I Added working countChar function
1 parent bd8ab4b commit 943e88e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Sprint-3/2-practice-tdd/count.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
function countChar(stringOfCharacters, findCharacter) {
2-
return 5
2+
let count = 0;
3+
4+
for (let i = 0; i < stringOfCharacters.length; i++) {
5+
if (stringOfCharacters[i] ===findCharacter) {
6+
count++;
7+
}
8+
}
9+
return count;
310
}
411

512
module.exports = countChar;

0 commit comments

Comments
 (0)