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

11 lines
236 B
JavaScript
Raw Permalink Normal View History

export function isPrime(value) {
2022-11-02 17:50:03 +00:00
var numero = parseInt(value);
var divisores = 0;
for (var count = 1; count <= numero; count++)
if (numero % count == 0) divisores++;
if (divisores == 2) return true;
else return false;
}