Skip to content

Commit 2a422f5

Browse files
committed
updated PR template
1 parent a61f9b1 commit 2a422f5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
// implement a function countChar that counts the number of times a character occurs in a string
22
const countChar = require("./count");
3+
4+
function countChar(stringOfCharacters, findCharacter) {
5+
let count = 0;
6+
for (let char of stringOfCharacters) {
7+
if (char === findCharacter) count++;
8+
}
9+
return count;
10+
}
11+
12+
module.exports = countChar;
13+
314
// Given a string str and a single character char to search for,
415
// When the countChar function is called with these inputs,
516
// Then it should:

0 commit comments

Comments
 (0)