Highest prime factor help.

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

function largestPrimeFactor(number) {
function isPrime(i){
  if ((i%2==0)||(i%3==0)||(i%5==0)||(i%7==0)){
    return false;
  }
  else{return true;}
};
for (let x=number; x>0; x--){
if (number%x==0){
  if (isPrime(x)){
    return x;
  }
}
}
return x;;

}



largestPrimeFactor(13195);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Linux; Android 9) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.58 Mobile Safari/537.36

Challenge: Problem 3: Largest prime factor

Link to the challenge:

Could you explain how you believe your prime checking function works? I don’t think that you quite understand primality.

Also, I would encourage you to format your code so that it is easier to read.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.