forked from M3-Academy/challenge-algorithms-v2.0
Entrega do Desafio #1
@ -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);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user