challenge-algorithms-v2.0-e.../08-isAnagram/index.js
2022-10-29 17:27:17 -03:00

10 lines
332 B
JavaScript

export function isAnagram(word1, word2) {
// implementar logica aqui
const word1LowerCase = word1.toLowerCase();
const word2LowerCase = word2.toLowerCase();
const word1Sorted = word1LowerCase.split('').sort().join('');
const word2Sorted = word2LowerCase.split('').sort().join('');
return word1Sorted === word2Sorted;
}