120. create `isPrime()`

JavaScriptAlgorithm
Is this helpful ?

easy  - accepted / - tried

A Prime number is a natural number greater than 1 that is divisible only by itself and 1, such as 2,3,5....

You are asked to implement isPrime() to check if a number is prime.

Follow-up

What is the time cost of your implementation ? can you improve your approach to have the fewest comparisons?

Let's try to solve this problem within 10 mintues.

Discuss(19)