![]() |
|
|
+ Search |
![]()
|
Dec 24th, 2005 06:50
Stian Totland, Kumar S,
You will have to use a comparison function:
myArray.sort(myNumberComparison);
myArray.reverse; // only if you want it reversed
function myNumberComparison(a,b){ // for numbers
return a[0] - b[0];
}
function myStringComparison(a,b){ // for strings
return a[0] > b[0] ? 1 : a[0] < b[0] ? -1 : 0;
}
Stian