Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

get ordinal number

const getOrdinalNum = (n) => n + (n > 0 ? ['th', 'st', 'nd', 'rd'][(n > 3 && n < 21) || n % 10 > 3 ? 0 : n % 10] : '');
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #ordinal #number
ADD COMMENT
Topic
Name
6+6 =