feat(isAnagram): fazendo funcão

This commit is contained in:
Caroline Moran 2022-10-28 07:43:43 -04:00
parent b797ec9a59
commit 401b1cc7ac

View File

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