devuelve el siguiente número primo más alto JavaScript

// 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
Shibu Sarkar