challenge-algorithms-v2.0-c.../08-isAnagram/index.js

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
}
}
}