View Single Post
Old 10-10-2012, 09:50 PM   PM User | #36
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
You could use a string rather than an array, incorporating:

XX = "thstndrd".substr((D % 10) * 2, 2) || "th";

It may not be shorter but avoids "Index out of range" or "undefined".

Oops! This is not quite right?!
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS

Last edited by AndrewGSW; 10-10-2012 at 09:58 PM..
AndrewGSW is offline   Reply With Quote