forked from M3-Academy/challenge-algorithms-v2.0
feat: cria algoritmo que retorne se um palavra é anagram da outra.
This commit is contained in:
parent
5a8fa6be43
commit
642f731562
@ -1,4 +1,8 @@
|
||||
export function isAnagram(word1, word2) {
|
||||
// implementar logica aqui
|
||||
|
||||
|
||||
let newWord = word1.toLowerCase().split("").sort().join();
|
||||
let newWord2 = word2.toLowerCase().split("").sort().join();
|
||||
|
||||
return (newWord === newWord2) ? true : false;
|
||||
}
|
Loading…
Reference in New Issue
Block a user