Javascript: isPrimeNumber checks whether given value is a prime number or not