ordinalize logic
converter available via negative lookbehind regular expression replacement.no redundant conditional branching.
how to use ordinalize
define Number.prototype
1. returnreturn(this+`th`).replace(/(?<!1)[123]th$/,v=>`1th`===v?`1st`:`2th`===v?`2nd`:`3rd`)