# Is the Number a Prime in javaScript?

I need a function that returns true if a number is prime and false if it's not. A prime number is any positive integer that is evenly divisible by only two divisors: 1 and itself. The first ten prime numbers are 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29.

1 Answer

a **prime number** is any **number** greater than 1 whose only factors are 1 and itself

look to this function

```
function isPrime(num){
for(let i = num-1; i > 1; i--) {
if(num%i === 0) return false;
}
return true;
}
```

answer Link