**Tell us what’s happening:**

The answer required is: `sumPrimes(977)`

should return 73156.

The below code does not pass for the number 977. However I have used other sites to check my answer and it comes out to be 73156. Have I done something wrong in my code?

**Your code so far**

```
function sumPrimes(num) {
var x = 0;
var y = 0;
console.log(num)
for (var i= 2; i<=num; i++){
for (var j= 1; j<=i; j++){
if (Number.isInteger(i/j) === true) {
x = x + 1;
}
}
//console.log(i)
//console.log(x)
if (x < 3) {
y = y + i;
}
console.log(y)
var x = 0;
}
return y;
}
sumPrimes(977);
```

**Link to the challenge:**

https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-primes/