Skip to content

Commit 42025c9

Browse files
author
russom
committed
A second if statement added into the function to check tests for numbers ending in nd.
1 parent 74d5e9f commit 42025c9

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ function getOrdinalNumber(num) {
44
if (lastDigit === 1 && lastTwoDigits !== 11) {
55
return `${num}st`;
66
}
7+
if (lastDigit === 2 && lastTwoDigits !== 12) {
8+
return `${num}nd`;
9+
}
10+
if
711
return `${num}th`;
812
}
913

0 commit comments

Comments
 (0)