Skip to content

Commit f84c03e

Browse files
committed
Update example outputs in countChar function for clarity
1 parent b3f1041 commit f84c03e

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,20 @@ function countChar(stringOfCharacters, findCharacter) {
2323
}
2424

2525
// Examples
26-
countChar("hello", "l"); // returns 2
27-
countChar("javascript", "a"); // returns 2
28-
countChar("hello", "z"); // returns 0
29-
countChar("null", ""); // "Error: The character to count must be a single character."
30-
countChar("", "a"); // "Error: The string cannot be empty."
31-
countChar("hello", "ll"); // "Error: The character to count must be a single character."
32-
countChar("hipopotamos' make wonderful pets", "o"); // returns 3
33-
countChar("hipopotamos", "p"); // returns 1
34-
countChar("hipopotamos' are a friendly animal", "t"); // returns 1
35-
countChar("hipopotamos", "x"); // returns 0
36-
countChar("Pneumonoultramicroscopicsilicovolcanoconiosis", "i"); // returns 6
37-
console.log(countChar("null", ""));
38-
console.log(countChar("", "a"));
39-
console.log(countChar("hello", "ll"));
40-
countChar(null, "a"); // "Error: The string cannot be empty."
26+
console.log(countChar("hello", "l")); // Expected: 2
27+
console.log(countChar("javascript", "a")); // Expected: 2
28+
console.log(countChar("hello", "z")); // Expected: 0
29+
console.log(countChar("null", "")); // Expected: "Error: The character to count must be a single character."
30+
console.log(countChar("", "a")); // Expected: "Error: The string cannot be empty."
31+
console.log(countChar("hello", "ll")); // Expected: "Error: The character to count must be a single character."
32+
console.log(countChar("hipopotamos' make wonderful pets", "o")); // Expected: 3
33+
console.log(countChar("hipopotamos", "p")); // Expected: 1
34+
console.log(countChar("hipopotamos' are a friendly animal", "t")); // Expected: 1
35+
console.log(countChar("hipopotamos", "x")); // Expected: 0
36+
console.log(countChar("Pneumonoultramicroscopicsilicovolcanoconiosis", "i")); // Expected: 6
37+
console.log(countChar("null", "")); // Expected: "Error: The character to count must be a single character."
38+
console.log(countChar("", "a")); // Expected: "Error: The string cannot be empty."
39+
console.log(countChar("hello", "ll")); // Expected: "Error: The character to count must be a single character."
40+
console.log(countChar(null, "a")); // Expected: "Error: The input string cannot be null or undefined."
4141

4242
module.exports = countChar;

0 commit comments

Comments
 (0)