Created
June 30, 2018 15:11
-
-
Save ecaepsey/cc2f18631d2387497be215ab9907e6d3 to your computer and use it in GitHub Desktop.
sorting
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
m.sort(function (a, b) { | |
if (a === b) { | |
return 0; | |
} | |
if (typeof a === typeof b) { | |
return a < b ? -1 : 1; | |
} | |
return typeof a < typeof b ? -1 : 1; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment