Earn extra honor and gain new allies!
Honor is earned for each new codewarrior who joins.
Learn more

num -> string -> array -> [sort(), reverse()] -> string -> num

JS is fun!

Code
Diff
  • const descendingOrder = n =>
      +[...''+n].sort().reverse().join``;
  • 1-function descendingOrder(n){
    2- return Number(String(n).split('').sort(function(a, b){return b-a}).join(''));
    3-}
    1+const descendingOrder = n =>
    2+ +[...''+n].sort().reverse().join``;