We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9e5a3cf commit 8706d73Copy full SHA for 8706d73
1 file changed
Sprint-3/2-practice-tdd/get-ordinal-number.js
@@ -3,13 +3,14 @@ function getOrdinalNumber(num) {
3
const lastTwoDigits = num % 100;
4
if (lastDigit === 1 && lastTwoDigits !== 11) {
5
return `${num}st`;
6
- } else if (lastDigit === 2 && lastTwoDigits !== 12) {
+ }
7
+ if (lastDigit === 2 && lastTwoDigits !== 12) {
8
return `${num}nd`;
- } else if (lastDigit === 3 && lastTwoDigits !== 13) {
9
10
+ if (lastDigit === 3 && lastTwoDigits !== 13) {
11
return `${num}rd`;
- } else {
- return `${num}th`;
12
}
13
+ return `${num}th`;
14
15
16
module.exports = getOrdinalNumber;
0 commit comments