Skip to content

Instantly share code, notes, and snippets.

@zachattack
Created July 9, 2019 15:24
Show Gist options
  • Save zachattack/a9d7dbabbbd2e87d954bc9339a1229f6 to your computer and use it in GitHub Desktop.
Save zachattack/a9d7dbabbbd2e87d954bc9339a1229f6 to your computer and use it in GitHub Desktop.
JS Descending Sort Numbers
function descendingOrder(n){
// Store your string manipulation in a results variable.
let results;
// Make sure the number isn't negative.
if(n>=0) {
return Number(results = String(n).split('').sort().reverse().join(""));
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment