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

16 lines
384 B
JavaScript
Raw Normal View History

export function isPrime(value) {
// implementar logica aqui
2022-10-30 15:48:44 +00:00
{ if ( value === 1 ) {
return false;
} else if ( value === 2 ) {
return true;
} else {
for ( var x = 2; x < value; x++ ) {
if ( value % x === 0 ) {
return false;
}
}
return true;
}
}
}