Skip to content

Instantly share code, notes, and snippets.

@jlbruno
Last active July 28, 2022 14:58
Show Gist options
  • Star 55 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save jlbruno/1535691 to your computer and use it in GitHub Desktop.
Save jlbruno/1535691 to your computer and use it in GitHub Desktop.
Javascript Ordinal Numbers
// found here http://forums.shopify.com/categories/2/posts/29259
var getOrdinal = function(n) {
var s=["th","st","nd","rd"],
v=n%100;
return n+(s[(v-20)%10]||s[v]||s[0]);
}
@aacassandra
Copy link

yo save my time bro!! very cool!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment