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 // implementar logica aqui
let primo; let primo;
if ( if (
number == 2 || value == 2 ||
number == 3 || value == 3 ||
number == 5 || value == 5 ||
number == 7 || value == 7 ||
number == 11 || value == 11 ||
number == 13 value == 13
) { ) {
primo = true; primo = true;
} else { } else {
primo = primo =
number % 2 != 0 && value % 2 != 0 &&
number % 3 != 0 && value % 3 != 0 &&
number % 5 != 0 && value % 5 != 0 &&
number % 7 != 0 && value % 7 != 0 &&
number % 11 != 0 && value % 11 != 0 &&
number % 13 != 0 value % 13 != 0
? "true" ? "true"
: "false"; : "false";
} }

View File

@ -1,4 +1,19 @@
export function isAnagram(word1, word2) { export function isAnagram(word1, word2) {
// implementar logica aqui // 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;
}