fix: ajuste no codigo que retorna se um palavra é anagram da outra

This commit is contained in:
Amanda de Almeida Fonseca 2022-11-01 16:24:49 -03:00
parent 96b864d058
commit 6313a99b4b

View File

@ -1,6 +1,11 @@
export function isAnagram(word1, word2) { export function isAnagram(word1, word2) {
// implementar logica aqui // implementar logica aqui
word1 = word1.toUpperCase().split("").sort().join(""); if (word1.length !== word2.length) {
word2 = word2.toUpperCase().split("").sort().join(""); return false
return word1 === word2; } else {
word1 = word1.toUpperCase().split("").sort().join("");
word2 = word2.toUpperCase().split("").sort().join("");
return word1 === word2;
}
} }