diff --git a/08-isAnagram/index.js b/08-isAnagram/index.js index 918308a..92a7dc2 100644 --- a/08-isAnagram/index.js +++ b/08-isAnagram/index.js @@ -1,4 +1,10 @@ export function isAnagram(word1, word2) { - // implementar logica aqui - -} \ No newline at end of file + const normalize = (str) => + str + .toLowerCase() + .replace(/[^a-z0-9]/gi, "") + .split("") + .sort() + .join(""); + return normalize(word1) === normalize(word2); +}