Skip to content

Commit ea81dae

Browse files
ensuring the test case is passing
1 parent 035ca52 commit ea81dae

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

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

Lines changed: 8 additions & 1 deletion
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+
4+
for (let x = 0; x < stringOfCharacters.length; x++) {
5+
if (stringOfCharacters[x] === findCharacter) {
6+
count ++;
7+
}
8+
}
9+
return count;
310
}
411

512
module.exports = countChar;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ test("should return 0 when character does not occur in string", () => {
2222
const char = "z";
2323
const count = countChar(str, char);
2424
expect(count).toEqual(0);
25-
})
25+
});
2626

2727
// Scenario: No Occurrences
2828
// Given the input string `str`,

0 commit comments

Comments
 (0)