**Tell us what’s happening:**

I got the correct result in my console output, but when I tried to run the test in freeCodeCamp test challenge editor, it wouldn’t pass the test for `sumPrimes(977);`

Is this a bug in their test, or is my code wrong?

**Your code so far**

```
function sumPrimes(num) {
let sum=2;
const isPrime=n=>{
let flag=0;
for(let i=2;i<n;i++){
if(n%i===0)
flag++;
}
return flag===0?true:false;
};
for(let i=3;i<=num;i++){
if(isPrime(i))
sum+=i;
}
return sum;
}
sumPrimes(977);
```

**Your browser information:**

User Agent is: `Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0`

.

**Link to the challenge:**

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