forked from M3-Academy/challenge-algorithms-v2.0
Merge pull request 'feat(desafio): Adiciona oitava tarefa concluida' (#7) from feature/isAnagram into feature/algoritmo
Reviewed-on: #7
This commit is contained in:
commit
6f25a0e147
@ -1,4 +1,11 @@
|
|||||||
export function isAnagram(word1, word2) {
|
export function isAnagram(word1, word2) {
|
||||||
// implementar logica aqui
|
// implementar logica aqui
|
||||||
|
const palavra = str =>
|
||||||
|
str
|
||||||
|
.toLowerCase()
|
||||||
|
.replace(/[^a-z0-9]/, '')
|
||||||
|
.split('')
|
||||||
|
.sort()
|
||||||
|
.join('');
|
||||||
|
return palavra(word1) === palavra(word2);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user