Skip to content

Instantly share code, notes, and snippets.

@br0xen
Created June 11, 2013 19:24
Show Gist options
  • Save br0xen/5759834 to your computer and use it in GitHub Desktop.
Save br0xen/5759834 to your computer and use it in GitHub Desktop.
Ordinal Number formatting in Javascript
Number.prototype.formatOrdinal=function(){var n=this,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