Skip to content

Instantly share code, notes, and snippets.

@alexeykomov
Last active October 5, 2016 14:44
Show Gist options
  • Save alexeykomov/d95b7262663c467a11aee20f062cf231 to your computer and use it in GitHub Desktop.
Save alexeykomov/d95b7262663c467a11aee20f062cf231 to your computer and use it in GitHub Desktop.
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