feat: adicionando solução do 8° desafio

This commit is contained in:
Ana Carolina Duarte Cavalcante 2022-10-28 08:46:58 -03:00
parent e7ebd59708
commit e78fc6780f

View File

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