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 8558783 commit ea7e00cCopy full SHA for ea7e00c
Sprint-3/2-practice-tdd/count.js
@@ -1,5 +1,14 @@
1
function countChar(stringOfCharacters, findCharacter) {
2
- return 5
+ const arrayOfCharacters = stringOfCharacters.split("");
3
+ let count = 0;
4
+ for (let index = 0; index < arrayOfCharacters.length; index++) {
5
+ if (arrayOfCharacters[index] === findCharacter) {
6
+ count += 1;
7
+ }
8
9
+ console.log(arrayOfCharacters);
10
+ console.log(count);
11
+ return count;
12
}
13
14
module.exports = countChar;
0 commit comments