Skip to content

Commit 9f01d08

Browse files
committed
implemented function countChart
1 parent b31a586 commit 9f01d08

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

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 countCharacter = 0;
3+
for (let i = 0; i < stringOfCharacters.length; i++){
4+
if (stringOfCharacters.charAt(i) === findCharacter){
5+
countCharacter += 1;
6+
}
7+
}
8+
return countCharacter
39
}
410

11+
512
module.exports = countChar;

0 commit comments

Comments
 (0)