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

11 lines
242 B
JavaScript
Raw Normal View History

export function isPrime(value) {
// implementar logica aqui
let numberOfDivisors = 0
for (let i = 1; i <= value; i++) {
if ((value % i) === 0) {
numberOfDivisors++;
}
}
return (numberOfDivisors === 2) ? true : false
}