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

15 lines
371 B
JavaScript
Raw Permalink Normal View History

export function isAnagram(word1, word2) {
// implementar logica aqui
2022-10-28 11:43:43 +00:00
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;
}
}