Skip to content

Commit 3c97cd2

Browse files
committed
tdd count errors fix
1 parent 589436f commit 3c97cd2

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
function countChar(stringOfCharacters, findCharacter) {
2-
return 5
2+
let count = 0;
3+
4+
for (const char of stringOfCharacters) {
5+
if (char === findCharacter) {
6+
count++;
7+
}
8+
}
9+
10+
return count;
311
}
412

513
module.exports = countChar;

0 commit comments

Comments
 (0)