forked from M3-Academy/challenge-algorithms-v2.0
feat(desafio): Adiciona oitava tarefa concluida
This commit is contained in:
parent
663341a99a
commit
a9b425e213
@ -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