Update isPrime.md
This commit is contained in:
@ -8,7 +8,7 @@ Return `false` if any of them divides the given number, else return `true`, unle
|
|||||||
```js
|
```js
|
||||||
const isPrime = num => {
|
const isPrime = num => {
|
||||||
const boundary = Math.floor(Math.sqrt(num));
|
const boundary = Math.floor(Math.sqrt(num));
|
||||||
for (var i = 2; i * i <= boundary; i++) if (num % i == 0) return false;
|
for (var i = 2; i <= boundary; i++) if (num % i == 0) return false;
|
||||||
return num >= 2;
|
return num >= 2;
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user