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

11 lines
248 B
JavaScript
Raw Normal View History

export function isAnagram(word1, word2) {
// implementar logica aqui
const palavra = str =>
str
.toLowerCase()
.replace(/[^a-z0-9]/, '')
.split('')
.sort()
.join('');
return palavra(word1) === palavra(word2);
}