Last active
October 5, 2016 14:44
-
-
Save alexeykomov/d95b7262663c467a11aee20f062cf231 to your computer and use it in GitHub Desktop.
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 sortString(str) { | |
return str.split('').sort().join(''); | |
} | |
function isAnagram(str1, str2) { | |
return sortString(str1) === sortString(str2); | |
} | |
console.log(isAnagram('кот', 'ток')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment