Made this for sum all primes challenge. The code works in Sublime but not on FCC. Any thoughts?
in sublime it returns 73156 (the right answer)
in FCC it returns 64615
Code so far
function sumPrimes(num) {
// start with a var to hold the total and set to zero
var sum = 0;
// run a loop from 2 to num inclusive
for(let i = 2; i <= num; i++) {
// set isPrime to true and try to prove false on next loop
let isPrime = true;
// checks if current i value is prime using a loop
// if i is not prime sets isPrime to false
for(let j = 2; j < i; j++) {
if(i % j === 0) {
isPrime = false;
}
}
// if isPrime is true add i to the sum
if(isPrime) {
sum += i;
}
}
// return the total
return sum;
}
sumPrimes(977);