Answers for "how to get prime numbers in javascript"

5

how to get prime numbers in javascript

function isPrime(num) {
    for (let i = 2; i * i <= num; i++)
        if (num % i === 0)
          return false; 
    return num > 1;
}
Posted by: Guest on May-22-2020

Code answers related to "how to get prime numbers in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language