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

15 lines
360 B
JavaScript
Raw Normal View History

export function isAnagram(word1, word2) {
// implementar logica aqui
2022-11-02 12:15:12 +00:00
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
}
}
}