- 1

How to do it

a program that orders numbers and reverses them in an array

9th Aug 2017, 12:35 PM
Tsholofelo Tshenyego
Tsholofelo Tshenyego - avatar
2 Respostas
+ 15
[2,6,3,7].sort().reverse() //sorted as characters thus wrong approach
9th Aug 2017, 12:45 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 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}));
9th Aug 2017, 1:01 PM
visph
visph - avatar