function addEnglishOrdinalSuffixes(number) {
const english_ordinal_rules = new Intl.PluralRules("en", {
type: "ordinal"
});
const suffixes = {
one: "st",
two: "nd",
few: "rd",
other: "th"
}
const suffix = suffixes[english_ordinal_rules.select(number)];
return (number + suffix);
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter