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

8 lines
223 B
JavaScript

export function isAnagram(word1, word2) {
let palavra1 = word1.toLowerCase().split('').sort().join('');
let palavra2 = word2.toLowerCase().split('').sort().join('');
return (palavra1 === palavra2);
}