2022-10-27 15:07:13 +00:00
|
|
|
export function isAnagram(word1, word2) {
|
|
|
|
// implementar logica aqui
|
2022-10-27 20:37:29 +00:00
|
|
|
word1 = word1.replace(/[^\w]/g, '').toLowerCase()
|
|
|
|
word2 = word2.replace(/[^\w]/g, '').toLowerCase()
|
|
|
|
|
|
|
|
return sortString(word1) === sortString(word2)
|
|
|
|
}
|
|
|
|
|
|
|
|
function sortString(string) {
|
|
|
|
return string.split('').sort().join('')
|
2022-10-27 15:07:13 +00:00
|
|
|
}
|