add isAnagram logic

This commit is contained in:
Marcela Mathias 2022-11-02 19:34:23 -03:00
parent c41078cac6
commit 79dcefcc41

View File

@ -1,4 +1,10 @@
export function isAnagram(word1, word2) {
// implementar logica aqui
const normalize = (str) =>
str
.toLowerCase()
.replace(/[^a-z0-9]/gi, "")
.split("")
.sort()
.join("");
return normalize(word1) === normalize(word2);
}