Created
February 10, 2017 09:48
-
-
Save srph/483d07b02b5c61704bfae925b6465f1c to your computer and use it in GitHub Desktop.
JS: Sort ascending, but sort invalid ones (0 in this case) to the end
This file contains hidden or 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
| [0,5,8,1,3,1,6].sort((a, b) => a === 0 ? true : a > b); | |
| // // [1, 1, 3, 5, 6, 8, 0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment