We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7661229 commit 1c57e2bCopy full SHA for 1c57e2b
Sprint-3/2-practice-tdd/count.js
@@ -1,8 +1,7 @@
1
function countChar(stringOfCharacters, findCharacter) {
2
let count = 0;
3
- let x = 0;
4
- for (; x < stringOfCharacters.length; x++) {
5
- if (stringOfCharacters[x] === findCharacter) {
+ for (let i = 0; i < stringOfCharacters.length; i++) {
+ if (stringOfCharacters[i] === findCharacter) {
6
count++;
7
}
8
0 commit comments