Created
December 20, 2017 06:43
-
-
Save stevenpray/6f120ac188fb32f8492d0b86fa5849d4 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
'use strict'; | |
/** | |
* | |
* @param {string} string1 | |
* @param {string} string2 | |
* @returns {boolean} | |
*/ | |
function isAnagram(string1, string2) { | |
var string1 = string1.split('').sort().join('').trim().toLowerCase(); | |
var string2 = string2.split('').sort().join('').trim().toLowerCase(); | |
return string1 === string2; | |
} | |
// console.log(isAnagram('mother in law', 'woman hitler')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment