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

13 lines
344 B
JavaScript

export function isAnagram(word1, word2) {
// implementar logica aqui
let array = word1.toLowerCase().split('').sort();
let array2 = word2.toLowerCase().split('').sort();
if (word1.length !== word2.length) {
return false;
} else {
if (array.toString() === array2.toString()) {
return true;
} else return false;
}
}