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

13 lines
323 B
JavaScript
Raw Normal View History

export function isAnagram(word1, word2) {
// implementar logica aqui
2022-11-02 12:05:37 +00:00
if (word1.length !== word2.length) {
return false;
}
2022-11-02 12:05:37 +00:00
let palavra1 = word1.toLowerCase().split('').sort().join('');
let palavra2 = word2.toLowerCase().split('').sort().join('');
let result = (palavra1 === palavra2);
return result;
}