// Write a function that takes a number (a) as argument. If a is prime number, return a. If a is not prime number then return the next higher prime number.
const nextPrimeNumber = (num) => {
for(let i = 2; i < num ; i++) {
if(num % i === 0) {
return nextPrimeNumber(num + 1)
}
}
return num;
};
const input = 90;
console.log(nextPrimeNumber(input)); // 97
function myFunction( a ) {
function isPrime(num) {
for (let i = 2; i <= Math.sqrt(num); i++) {
if (num % i === 0) return false;
}
return num > 1;
}
let n = a;
while (!isPrime(n)) n++;
return n
}