diff --git a/08-isAnagram/index.js b/08-isAnagram/index.js index 918308a..75342f4 100644 --- a/08-isAnagram/index.js +++ b/08-isAnagram/index.js @@ -1,4 +1,22 @@ export function isAnagram(word1, word2) { - // implementar logica aqui + let test = word1.toUpperCase(); + let original = word2.toUpperCase(); + + let tamanho1 = original.length; + let tamanho2 = test.length; + + if(tamanho1 !== tamanho2){ + return false; + } + + let str1 = original.split('').sort().join(''); + let str2 = test.split('').sort().join(''); + + if(str1 === str2){ + return true; + } + else{ + return false; + } } \ No newline at end of file