forked from M3-Academy/challenge-algorithms-v2.0
Merge branch 'feature/isanagram' into development
This commit is contained in:
commit
09f86ca87a
@ -1,4 +1,15 @@
|
|||||||
export function isAnagram(word1, word2) {
|
export function isAnagram(word1, word2) {
|
||||||
// implementar logica aqui
|
// implementar logica aqui
|
||||||
|
let palaminu1 = word1.toLowerCase();
|
||||||
|
let palaminu2 = word2.toLowerCase();
|
||||||
|
palaminu1 = palaminu1.split('')
|
||||||
|
palaminu2 = palaminu2.split('')
|
||||||
|
palaminu1 = palaminu1.sort()
|
||||||
|
palaminu2 = palaminu2.sort()
|
||||||
|
palaminu1 = palaminu1.join('')
|
||||||
|
palaminu2 = palaminu2.join('')
|
||||||
|
if(palaminu1 == palaminu2){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user