Ordinal Number in javascript (1st, 2nd, 3rd, 4th)

Fortune_Cookie_
Shopify Partner
113 0 5
found a beautiful method online for creating ordinal numbers (1st, 2nd, 3rd 4th etc) (vs. cardinal 1, 2, 3, 4) and thought I'd share - just love how simple it is.

function getGetOrdinal(n) {
   var s=["th","st","nd","rd"],
       v=n%100;
   return n+(s[(v-20)%10]||s[v]||s[0]);
}
Unique Bath Gifts by Fortune Cookie Soap ~ http://www.FortuneCookieSoap.com ~ @fortunefreak
Replies 0 (0)