ordinal number in javascript Jan
15
1
3

Here's a slick way to create ordinal numbers in javascript that I found.

function getGetOrdinal(n) {
   var s=["th","st","nd","rd"],
       v=n%100;
   return n+(s[(v-20)%10]||s[v]||s[0]);
}
Bookmark and Share
blog comments powered by Disqus