forked from M3-Academy/challenge-algorithms-v2.0
Merge branch 'feature/isAnagram'
This commit is contained in:
commit
07f5b2dd39
@ -1,4 +1,10 @@
|
|||||||
export function isAnagram(word1, word2) {
|
export function isAnagram(word1, word2) {
|
||||||
// implementar logica aqui
|
const normalize = (str) =>
|
||||||
|
str
|
||||||
|
.toLowerCase()
|
||||||
|
.replace(/[^a-z0-9]/gi, "")
|
||||||
|
.split("")
|
||||||
|
.sort()
|
||||||
|
.join("");
|
||||||
|
return normalize(word1) === normalize(word2);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user