Skip to content

Commit 6db0981

Browse files
committed
Implement countChar function to count occurrences of a character in a string
1 parent 2c2b0f3 commit 6db0981

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
function countChar(stringOfCharacters, findCharacter) {
2-
return 5
2+
const characterOccurrence = stringOfCharacters.split(findCharacter).length - 1;
3+
return characterOccurrence;
34
}
45

56
module.exports = countChar;

0 commit comments

Comments
 (0)