diff --git a/08-isAnagram/index.js b/08-isAnagram/index.js index 918308a..d47e20b 100644 --- a/08-isAnagram/index.js +++ b/08-isAnagram/index.js @@ -1,4 +1,22 @@ export function isAnagram(word1, word2) { // implementar logica aqui + if (word1 != word2){ + if (word1.lenght == word2.lenght){ + word1 = word1.toLowerCase(); + word2 = word2.toLowerCase(); + let teste = word1.split(''); + let origin = word2.split(''); + teste = teste.sort(); + origin = origin.sort(); + teste = teste.join(); + origin = origin.join(); + if (teste == origin) + return true; + else + return false; + } + else return false; +} +else return false; } \ No newline at end of file