Skip to content

Commit 21765d4

Browse files
committed
Fix bug in line 62 of cases.js that caused incorrect results in certain conditions.
1 parent a28e020 commit 21765d4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Sprint-2/implement/cases.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,14 @@ function lastLetterCapitalized(str) {
5959
let result = "";
6060

6161
for (let i = 0; i < str.length; i++) {
62-
if (str[i + 1] === " " || i === str.length - 1) {
62+
if (i === str.length - 1 || str[i + 1] === " " ) {
6363
result += str[i].toUpperCase();
64-
} else {
64+
} else {
6565
result += str[i];
6666
}
67-
}
67+
// console.log(`positions ${i}: of str ${str[i]}`);
6868

69+
}
6970
return result;
7071
}
7172

0 commit comments

Comments
 (0)