Created
June 4, 2012 21:18
-
-
Save hughes/2870897 to your computer and use it in GitHub Desktop.
This file contains 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
// Returns the orginal of an integer | |
function getOrdinal(n) { | |
var s = ["th","st","nd","rd"]; | |
var v = n % 100; | |
return (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