javascript - Add st, nd, rd and th (ordinal) suffix to a number - Stack Overflow
var j = i % 10,
k = i % 100;
if (j == 1 && k != 11) {
return i + "st";
}
if (j == 2 && k != 12) {
return i + "nd";
}
if (j == 3 && k != 13) {
return i + "rd";
}
return i + "th";
javascript  ordinal_suffix  date 
march 2017
« earlier      
& @anywhere @font-face @media a a/b a11y accessbility accessibility adactio addy_osmani adobe advertising advice aerotwist ajax alex_gibson alfred alistapart amp analysis analytics and android animation animations annotations answers apache api apis app appcache apps architecture aria array art article async audio autofocus avemagnus avephotography background background_sync backgrounds backlink backlinks backup bias bind blacklist blacklists blog blogs boilerplate book bookmarklet border border-radius borders boredom box boxmodel branch broken browser browsers bruce building business button buttons by cache canvas cards carousel cart category cdn center centered character cheat cheatsheet check checker checklist chic chicmessy chris_coyier christian christian_heilmann chrome classlist code codes coding codrops colossal colour colours commands comments completion compressor concat conditional conditional_loading conditionalcomments configurable console content contrast conversion copywriting cpanel creativity cro css css-tricks css3 css_animations css_tricks currying cursors custom custom_walker customfields data data-uri date david_walsh debug debugging demo design dev dev_tools development devices devon directions discover diveintohtml5 documentation dom domain domtokenlist doodle drop e-commerce ecommerce elements email encryption entities error escape event events excerpt expression extensions eykawdiw facebook faith fanpage fashion fatal favicon favorites feature feature_detection feed feedly file filters firefox fix flash flexbox flexible flip font font-face fonts for forbidden form forms framework free free-shipping frontend fubiz™ functions funny gallery garden gds geolocation getusermedia git github google googlereader gorg govuk gradients grid grunt guardian gzip harry_roberts heart; heilmann hex hide highlight history holiday horizontal hover htaccess html html5 html5_rocks http https hyphens icon icons ideas ie ie8 iframe ifttt ifttt_twitter_favorites illustrations image imagereplacement images indexeddb infographic inline-block input inspector install instanceof interactive interesting ios ipad iphone iphone4 is javascript jeremy_keith josh_emerson jquery jqueryui js jslive keith keyboard keygen keywordanalysis keywords kids language later launch lawson's layout learn less lifestyle line-height link links list load loading local localstorage logo louis_lazaris lukew magazine magento mailing_list management manifest map maps marketing mathiassen mdn measure media media-queries media:image mediaqueries menu merge messy meta metadata microformats microsoft minification minify mobile modal mozilla multiple mysql navigation nessy nettuts nicholas_c_zakas node_insertions numbers of offline oocss opacity opera optimisation optimization osx ours p2p page pages pamela_fox parallax password password_free path pattern paul paul_irish paul_lewis paypal pdf perf performance personal philip_walton photo photography photoshop php pitfalls placeholder places player plugins pointer_events polyfill portrait position post posters pr preview print product productivity products programming progressive_enhancement project prototypal_inheritance prototype queries questions radius random rdfa read recently reference regex regular rename replacement resources respimg responsive roi role roles row ruigrok rwd sara_soueidan sass saved schema.org scott_jehl scp screen scroll scrolling search sectioning secure security select seo server serviceworkers shadow shadow_dom sheet shop shortcuts show showcase site sitepoint sites sitespeed slider slides smashing smashing_magazine snippets social socialmedia spec specificity speed spelling srcset ssh ssl stats steve_faulkner sticky storage strict style styleguide sublime_text support svg syntax tab table tabs talk tech template templates terminal test testing text textarea this thumbnail tile tips toby_osbourn todd_motto tom_maslen tools torment touch transform transistion transition transitions tutorial twitter type typeof types typography unicode unsaved upload url usability ux validation vanilla_js vectro vendor vendor_prefixes vertical video video_chat viewport vim voll w3c wai-aria we web web_components web_design web_workers webapp webdesign webdev webfonts webpagetest webrtc websites websockets windows word-break wordpress work workflow writing xml youtube yui | »

Copy this bookmark:



description:


tags: