View Single Post
Old 12-28-2012, 04:12 PM   PM User | #6
123jo
New Coder

 
Join Date: Dec 2012
Posts: 10
Thanks: 2
Thanked 0 Times in 0 Posts
123jo is an unknown quantity at this point
Thanks for your answers! But, @Old Pedant, I don't really understand what does:

Code:
function sortOnNumeric( a, b )
{
return Number( b.replace(/\D/g,"") ) - Number( a.replace(/\D/g,"") );
}
And I don't want to use .sort...(the execution speed isn't an issue)

Basically, what I'm looking to do is to see if the string I'm about to add has an integer bigger than the first one in the result array. If it does, put it at the beginning of the array; if not, push it at the end. I can't think of any other way to sort an array in descending order without using .sort
123jo is offline   Reply With Quote