Hi everyone! I'm new to this forum and I hope I can be useful to this community now that I'm learning Javascript

I have a problem with a Javascript function. It's a simple script to check if a number is a prime number or not. I know there's already lots of this examples on the Internet but I didn't wanted to check them only to see if I could do it on my own.

So, here's my script. It's works just fine, but for some reason, when I write 33, the script says it is a prime number, when it's not. Any ideas?

//Prime number checker
//@rodochoa
var i =parseInt(prompt("Write a number"));
isPrime(i);
function isPrime(num){

if(num === 1 || num ===2 || num===3){
//If the input is 1,2,3 it prints directly without checking
console.log(num + " is a prime number");
}
else{
for(i=2;i<num;i++){
if(num%i===0){
console.log(num + " is not a prime number");
break;
}
else{
console.log(num + " is a prime number");
break;
}
}

}
}

Thanks in advance And greetings from Mexico.