Created
July 9, 2019 15:24
-
-
Save zachattack/a9d7dbabbbd2e87d954bc9339a1229f6 to your computer and use it in GitHub Desktop.
JS Descending Sort Numbers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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