**Tell us what’s happening:**

Help why is my code failing for test sum Primes(977) should return 73156.

yet that’s the right answer i get on my console when testing the code

Help

**Your code so far**

```
function isPrime(num) {
if(num<2) {
return false;
}
for(let i=num-1;i>1;i--) {
if(num%i===0) {
return false;
}
}
return true;
}
function sumPrimes(num) {
let i = 1;
let sum = 0;
while(i<=num) {
if(isPrime(i)) {
sum+=i;
}
i++;
}
return sum;
}
sumPrimes(10);
```

**Your browser information:**

User Agent is: `Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36`

.

**Link to the challenge:**

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