Skip to content

Commit 602f4d6

Browse files
committed
fix formatting
1 parent d86c3ed commit 602f4d6

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

Sprint-3/2-practice-tdd/get-ordinal-number.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ function getOrdinalNumber(num) {
44
throw new Error("Invalid input: number must be a non-negative integer");
55
}
66

7-
if (num % 100 >= 11 && num % 100 <= 13) { // check for numbers ending with 11, 12, or 13
7+
if (num % 100 >= 11 && num % 100 <= 13) {
8+
// check for numbers ending with 11, 12, or 13
89
return num + "th";
9-
} else if (num % 10 === 1) { // check for numbers ending with 1 (but not 11)
10+
} else if (num % 10 === 1) {
11+
// check for numbers ending with 1 (but not 11)
1012
return num + "st";
11-
} else if (num % 10 === 2) { // check for numbers ending with 2 (but not 12)
13+
} else if (num % 10 === 2) {
14+
// check for numbers ending with 2 (but not 12)
1215
return num + "nd";
13-
} else if (num % 10 === 3) { // check for numbers ending with 3 (but not 13)
16+
} else if (num % 10 === 3) {
17+
// check for numbers ending with 3 (but not 13)
1418
return num + "rd";
1519
}
1620
// For all other numbers, append "th"

0 commit comments

Comments
 (0)