Skip to content

Commit e196238

Browse files
committed
Refactor code.
1 parent c1a84c9 commit e196238

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎practice-tdd/count.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export function countChar(stringOfCharacters, findCharacter) {
22
let count = 0;
3-
for (let i = 0; i < stringOfCharacters.length; i++) {
4-
if (stringOfCharacters[i] === findCharacter) {
3+
for (const char of stringOfCharacters) {
4+
if (char === findCharacter) {
55
count++;
66
}
77
}

0 commit comments

Comments
 (0)