Hi jsWalter,
You beat me to it. I was going to do it in one step
Code:
function num_abbrev_str(n)
{
return n + (( Math.floor((n%100)/10) == 1) ? "th" : ["th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th"][n%10]);
}
but it is essentially the same thing.
I just noticed that liorean is assuming that in boolean expressions true==1
( this % 100 - nModTen != 10 )
Should evaluate to 0 or 1 and then multiply it by a value.
Hmm sneaky

(but maybe a little dangerous)