finding sum of prime numbers under 250
问题 var sum = 0 for (i = 0; i < 250; i++) { function checkIfPrime() { for (factor = 2; factor < i; factor++) { if (i % factor = 0) { sum = sum; } else { sum += factor; } } } } document.write(sum); I am trying to check for the sum of all the prime numbers under 250. I am getting an error saying that i is invalid in the statement if (i % factor = 0) I know was creating in the original for statement, but is there any way to reference it in the if statement? 回答1: With the prime computation, have you