Node.js examples for Number:Format
Converting Numbers to Ordinals
function getOrdinal(n) { var ord = "th"; if (n % 10 == 1 && n % 100 != 11) { ord = "st";/*from w ww . ja v a2s . c o m*/ } else if(n % 10 == 2 && n % 100 != 12) { ord = "nd"; } else if(n % 10 == 3 && n % 100 != 13) { ord = "rd"; } return ord; }