Skip to content

Instantly share code, notes, and snippets.

@mikeriley131
Created October 12, 2016 18:53
Show Gist options
  • Save mikeriley131/4d0455181a77d08132c75e5e71b166a2 to your computer and use it in GitHub Desktop.
Save mikeriley131/4d0455181a77d08132c75e5e71b166a2 to your computer and use it in GitHub Desktop.
number ordinal indicator
if (place.toString().substr(-1) === '1' && place !== 11) {
place = place + 'st'
}
else if (place.toString().substr(-1) === '2' && place !== 12) {
place = place + 'nd'
}
else if (place.toString().substr(-1) === '3' && place !== 13) {
place = place + 'rd'
}
else {
place = place + 'th'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment