Skip to content

Commit 1c57e2b

Browse files
committed
fixed the loop
1 parent 7661229 commit 1c57e2b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
function countChar(stringOfCharacters, findCharacter) {
22
let count = 0;
3-
let x = 0;
4-
for (; x < stringOfCharacters.length; x++) {
5-
if (stringOfCharacters[x] === findCharacter) {
3+
for (let i = 0; i < stringOfCharacters.length; i++) {
4+
if (stringOfCharacters[i] === findCharacter) {
65
count++;
76
}
87
}

0 commit comments

Comments
 (0)