how it works prime number in javascript code example
Example: prime numbers javascript
function isPrime(num) {
for (let i = 2; i * i <= num; i++)
if (num % i === 0)
return false;
return num > 1;
}
function isPrime(num) {
for (let i = 2; i * i <= num; i++)
if (num % i === 0)
return false;
return num > 1;
}