Write a recursive function isPrime that determines if a number is prime and returns true if it is. recursion js
function isPrime(num, div = 3){
if(num === 2) return true;
if(num < 2 || num % 2 === 0) return false;
if(div * div > num) return true;
if(num % div === 0) return false;
return isPrime(num, div + 2);
}
console.log(isPrime(1)); //-> false
console.log(isPrime(2)); //-> true
console.log(isPrime(3)); //-> true
console.log(isPrime(4)); //-> false