We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b31a586 commit 9f01d08Copy full SHA for 9f01d08
1 file changed
Sprint-3/2-practice-tdd/count.js
@@ -1,5 +1,12 @@
1
function countChar(stringOfCharacters, findCharacter) {
2
- return 5
+ 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
9
}
10
11
+
12
module.exports = countChar;
0 commit comments