forked from M3-Academy/challenge-algorithms-v2.0
feature/algoritmo #11
@ -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