Skip to content

Instantly share code, notes, and snippets.

@ajace
Created October 20, 2015 18:40
Show Gist options
  • Save ajace/c353418ade158b0bf89f to your computer and use it in GitHub Desktop.
Save ajace/c353418ade158b0bf89f to your computer and use it in GitHub Desktop.
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