21 lines
437 B
JavaScript
21 lines
437 B
JavaScript
export function isAnagram(word1, word2) {
|
|
// implementar logica aqui
|
|
let par_1 = word1.toLowerCase().split("").sort();
|
|
let par_2 = word2.toLowerCase().split("").sort();
|
|
let final;
|
|
let i = 0;
|
|
if (par_1.length != par_2.length) {
|
|
final = false;
|
|
} else {
|
|
for (i in par_1) {
|
|
if (par_1[i] != par_2[i]) {
|
|
final = false;
|
|
break;
|
|
} else {
|
|
final = true;
|
|
}
|
|
}
|
|
}
|
|
return final;
|
|
}
|