Making a code to check for primes numbers NOT WORKING

This is the code Plz help fix

var prime=true
var isPrime=function(number) {
    while(prime){
        for(i=1,i<=number,i++){
            if(number%i !== 0){
                console.log("Your number isn't prime")
                prime=false;
            }    
            if(i===number){
                ("Your number is prime")
                prime=false;
            }
    }
}
}
isPrime(prompt("What number do you want to check primity for"))
  1. Used a comma instead of semicolon in your for loop condition
  2. Duplicated if statements, use else if or else.
  3. missing console.log in second statement, before the string & parenthesis.

Now, the problem with the function logic itself, is that relying on the modular won’t allways guarantee the number isn’t a prime. A non prime may go into an odd prime number.

5%2.5
0

Here’s a quick idea about how I feel you would want to find out if a number is prime, without using an existing function. I would divide it incrementally until you get a 0.

function check(number) {
   var store;
   for(i=2; i<250; i++) {
     store = number/i;
     console.log(store);
   }
}

check(234);

@emgo_dev Thanks I figured out how to do it and this is my new code

var checkPrime=function(number){
var prime=true
if(isNaN(number)>=true){
    prime=false;
    number=prompt("please enter a number");
    if(number===2) {
        alert("Your number is prime");
        prime=false;
    }

while(prime) {
    for(var i=2;i<number;i++) {
        }
        if(number%i===0) {
            alert("Your number is not prime");
            i=number + 1;
            prime = false;
        }    
        if(i===number - 1) {
        alert("Your number is prime");
        i=number + 1;
        prime = false;
        }    
    }
}
}
checkPrime(prompt("What number would you like to check prime for?"))