Number.prototype.ordinal=function(){ var nModTen = this % 10; return (this + ['th','st','nd','rd'][nModTen > 3 ? 0 : ( this % 100 - nModTen != 10) * nModTen]); }