Skip to content

Commit 1ec6fee

Browse files
committed
Update test.js
getOrdinalNumber for EN-US
1 parent dc34989 commit 1ec6fee

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,15 @@ function getValueColor(value, limits) {
2525
return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
2626
}
2727
}
28+
29+
30+
function getOrdinalNumber(n) {
31+
if (n < 11 || n > 13) {
32+
switch (n % 10) {
33+
case 1: return n + 'st';
34+
case 2: return n + 'nd';
35+
case 3: return n + 'rd';
36+
}
37+
}
38+
return n + 'th';
39+
}

0 commit comments

Comments
 (0)