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 c7bf47b commit 1f4a688Copy full SHA for 1f4a688
1 file changed
Sprint-3/2-practice-tdd/get-ordinal-number.js
@@ -1,8 +1,10 @@
1
function getOrdinalNumber(num) {
2
// return "1st";
3
- if (num % 100 >= 11 && num % 100 <= 13) {
4
- return num + "th";
5
- }
+``
+ const lastTwoDigits = num % 100;
+ if (lastTwoDigits >= 11 && lastTwoDigits<= 13)
6
+ return num + "th";
7
+
8
if (num % 10 === 1) {
9
return num + "st";
10
}
0 commit comments