- 1
How to do it
a program that orders numbers and reverses them in an array
2 Respostas
+ 15
[2,6,3,7].sort().reverse()
//sorted as characters thus wrong approach
+ 4
@VH: this will not work with [42,3,127] ;P
Good answer is:
alert([42,3,127].sort(function(a,b) {return b-a}));