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

8 lines
223 B
JavaScript
Raw Permalink Normal View History

export function isAnagram(word1, word2) {
2022-10-28 21:24:03 +00:00
let palavra1 = word1.toLowerCase().split('').sort().join('');
2022-10-29 02:52:50 +00:00
let palavra2 = word2.toLowerCase().split('').sort().join('');
2022-10-28 21:24:03 +00:00
return (palavra1 === palavra2);
}