challenge-algorithms-v2.0-R.../08-isAnagram/index.js

18 lines
382 B
JavaScript

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;
}
}