Skip to content

Commit cfbead8

Browse files
committed
2-practice-tdd count.js implemented
1 parent 518313e commit cfbead8

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
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+
for (let i = 0; i<stringOfCharacters.length; i++){
4+
if (stringOfCharacters[i] === findCharacter){
5+
count++;
6+
}
7+
}
8+
return count;
39
}
10+
console.log(countChar("please work for me", "e" ))
411

5-
module.exports = countChar;
12+
module.exports = countChar;

0 commit comments

Comments
 (0)