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 edb4fe4 commit fc349abCopy full SHA for fc349ab
1 file changed
Sprint-3/2-practice-tdd/count.js
@@ -1,5 +1,12 @@
1
function countChar(stringOfCharacters, findCharacter) {
2
- return 5
+ let count = 0;
3
+ let x = 0;
4
+ for (; x < stringOfCharacters.length; x++) {
5
+ if (stringOfCharacters[x] === findCharacter) {
6
+ count++;
7
+ }
8
9
+ return count;
10
}
11
12
module.exports = countChar;
0 commit comments