challenge-algorithms-v2.0/05-isPrime/index.js

26 lines
437 B
JavaScript
Raw Normal View History

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