Created
October 20, 2015 18:40
-
-
Save ajace/c353418ade158b0bf89f to your computer and use it in GitHub Desktop.
Ordinal Suffix - http://jsfiddle.net/thisishardcoded/DbSMB/
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
function addOrdinalSuffix(number) { | |
return number+(['st','nd','rd'][( number +'').match(/1?\d\b/)-1]||'th'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment