diff --git a/08-isAnagram/index.js b/08-isAnagram/index.js index 918308a..1361c11 100644 --- a/08-isAnagram/index.js +++ b/08-isAnagram/index.js @@ -1,4 +1,13 @@ export function isAnagram(word1, word2) { // implementar logica aqui - -} \ No newline at end of file + let word1Lower = word1.toLowerCase() + let word2Lower = word2.toLowerCase() + if (word1Lower.length !== word2Lower.length) { + return false; +} +var string1 = word1Lower.split('').sort().join(''); +var string2 = word2Lower.split('').sort().join(''); + +var result = (string1 === string2); +return result; +}