forked from M3-Academy/challenge-algorithms-v2.0
fix: ajuste no codigo que retorna se um palavra é anagram da outra
This commit is contained in:
parent
96b864d058
commit
6313a99b4b
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user