11 lines
301 B
JavaScript
11 lines
301 B
JavaScript
export function isAnagram(word1, word2) {
|
|
// implementar logica aqui
|
|
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('')
|
|
} |