feat: Implementa Desafio 2.8

This commit is contained in:
Sabrina Miranda 2022-10-28 19:38:01 -03:00
parent 468061254e
commit b806b8aa33

View File

@ -1,4 +1,18 @@
export function isAnagram(word1, word2) {
// implementar logica aqui
let anagram;
if(word1.length !== word2.length) {
anagram = false;
}
let palavra1 = word1.toLowerCase().split("").sort().join("");
let palavra2 = word2.toLowerCase().split("").sort().join("");
if(palavra1 === palavra2) {
anagram = true;
}else {
anagram = false;
}
return anagram;
}