feature/isAnagram #9

Merged
ViniciusDeniz merged 2 commits from feature/isAnagram into master 2022-11-02 23:06:33 +00:00
2 changed files with 29 additions and 14 deletions

View File

@ -2,22 +2,22 @@ export function isPrime(value) {
// implementar logica aqui
let primo;
if (
number == 2 ||
number == 3 ||
number == 5 ||
number == 7 ||
number == 11 ||
number == 13
value == 2 ||
value == 3 ||
value == 5 ||
value == 7 ||
value == 11 ||
value == 13
) {
primo = true;
} else {
primo =
number % 2 != 0 &&
number % 3 != 0 &&
number % 5 != 0 &&
number % 7 != 0 &&
number % 11 != 0 &&
number % 13 != 0
value % 2 != 0 &&
value % 3 != 0 &&
value % 5 != 0 &&
value % 7 != 0 &&
value % 11 != 0 &&
value % 13 != 0
? "true"
: "false";
}

View File

@ -1,4 +1,19 @@
export function isAnagram(word1, word2) {
// implementar logica aqui
}
let par_1 = word1.toLowerCase().split("").sort();
let par_2 = word2.toLowerCase().split("").sort();
let final;
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;
}