Skip to content

Commit 52cc0b0

Browse files
committed
feat: updates lexicographically condition
1 parent 9c37bd5 commit 52cc0b0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lesson_07/conditionals/src/lesson7.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ export function compareStrings(a: string, b: string): number {
2525
// The distance will be a number less than 0 if string `a` is lexicographically less than `b`, 1
2626
// if it is greater, and 0 if the strings are equal.
2727
const distance = computeLexicographicDistance(a, b);
28-
if (a < b) {
28+
if (distance < 0) {
2929
return -1;
30-
} else if (a > b) {
30+
} else if (distance > 0) {
3131
return 1;
3232
} else {
3333
return 0;

0 commit comments

Comments
 (0)