export function isAnagram(word1, word2) { let teste, original, cont1 = 0, cont2 = 0; teste = word1.split(""); original = word2.split(""); if (teste.length === original.length) { for (let i = 0; i < teste.length; i++) { cont1 = 0; cont2 = 0 for (let j = 0; j < teste.length; j++) { if (teste[i].toUpperCase() === teste[j].toUpperCase()) { cont1++; } } for (let k = 0; k < original.length; k++) { if (teste[i].toUpperCase() === original[k].toUpperCase()) { cont2++; } } if (cont1 === cont2) { return true; } else { return false; } } } else { return false } }