Created
February 2, 2017 06:29
-
-
Save xexi/a015448db6436c8f6632e1cad0086e59 to your computer and use it in GitHub Desktop.
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
var korean = [ "다", "나", "가" ]; | |
function ascending ( a , b ) { | |
return a.localeCompare ( b ); | |
} | |
function descending ( a , b ) { | |
return b.localeCompare ( a ); | |
} | |
console.log('asc: '+korean.sort(ascending)); | |
console.log('desc: '+korean.sort(descending)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment