Skip to content

Commit 6ab27fc

Browse files
committed
Biuld a countChar Code
1 parent 8f3d6cf commit 6ab27fc

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
function countChar(stringOfCharacters, findCharacter) {
2-
return 5
1+
function countChar(str, char) {
2+
return str.split(char).length - 1;
33
}
44

55
module.exports = countChar;
6+
7+
console.log(
8+
countChar(
9+
"The split() method of String values takes a pattern and divides this string into an ordered list of substrings by searching for the pattern, puts these substrings into an array, and returns the array.",
10+
"a"
11+
)
12+
);

0 commit comments

Comments
 (0)