View Single Post
Old 11-26-2003, 01:00 AM   PM User | #23
liorean
The thread killer


 
Join Date: Feb 2003
Location: Umeå, Sweden
Posts: 5,575
Thanks: 0
Thanked 84 Times in 75 Posts
liorean will become famous soon enoughliorean will become famous soon enough
Oh, having a look at your code, this change saves space, but I think it makes for slightly worse performance. I think it's cleaner looking, though:
Code:
function num_abbrev_str(n)
{
 return n + (( Math.floor((n%100)/10) == 1) ? "th" : ([, "st", "nd", "rd", ,,,,,][n%10]) || 'th');
}
__________________
liorean <[lio@wg]>
Articles: RegEx evolt wsabstract , Named Arguments
Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards
liorean is offline   Reply With Quote