**Tell us what’s happening:**

Using another program, I ran the code, and it appears to return the right values (10 returns 17, 977 returns 73156) but the FCC tests say that sumPrimes(977) does not return the right value.

Any help appreciated

**Your code so far**

```
function sumPrimes(num) {
let sum=0;
let index =2;
while(index<=num)
{
let isPrime=true;
for(let i=2;i<index;i++)
{
if(index % i ==0)
{
isPrime=false;
}
}
if(isPrime==true)
{
sum+=index;
}
index++;
}
return sum;
console.log(sum);
}
sumPrimes(10);
```

**Your browser information:**

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

.

**Link to the challenge:**

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