Function to check if a number is prime?

0
const isPrime = num => {
    for(let i = 2;i <= num-1; i++)
        if(num % i === 0) return false; 
    return num > 1;
}

Leave a Comment

Skip to content