feat: implementa função isAnagram

This commit is contained in:
RodrigoJorge 2022-10-28 15:52:36 -03:00
parent 4965ff8076
commit 94db3cf689

View File

@ -1,4 +1,18 @@
export function isAnagram(word1, word2) {
// implementar logica aqui
let original = word1.toLowerCase();
let original2 = original.split("");
let original3 = original2.sort().join("");
let teste = word2.toLowerCase();
let teste2 = teste.split("");
let teste3 = teste2.sort().join("");
if(original3 == teste3){
return true;
}
else{
return false;
}
}