Created
March 6, 2015 03:31
-
-
Save feload/cf8bcd0e0f6ccdd0ab00 to your computer and use it in GitHub Desktop.
Ordinals
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getGetOrdinal(n) { | |
var s=["th","st","nd","rd"], | |
v=n%100; | |
return n+(s[(v-20)%10]||s[v]||s[0]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment