Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

prime numbers javascript

function isPrime(num) {
    for (let i = 2; i * i <= num; i++)
        if (num % i === 0)
          return false; 
    return num > 1;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #prime #numbers #javascript
ADD COMMENT
Topic
Name
2+7 =