15 lines
360 B
JavaScript
15 lines
360 B
JavaScript
export function isAnagram(word1, word2) {
|
|
// implementar logica aqui
|
|
if (word1.length != word2.length) {
|
|
return false
|
|
} else {
|
|
const string1 = word1.toLowerCase().split("").sort().join("");
|
|
const string2 = word2.toLowerCase().split("").sort().join("");
|
|
|
|
if (string1 === string2) {
|
|
return true
|
|
} else {
|
|
return false
|
|
}
|
|
}
|
|
} |