**Tell us what’s happening:**

I wrote a recursive function for the sum all primes challenge; I’m returning the desired number, but after the return my function keeps running. I’m not sure what I’ve done wrong. Any suggestions to modify the following would be much appreciated. Thanks!

```
**Your code so far**
```

```
let primeArray = [];
function sumPrimes(num) {
let primeCheck = 0;
if (num === 2) {
primeArray.push(2)
console.log(primeArray)
console.log(`reduce to **${primeArray.reduce((acc, val) => acc + val)}** and return the result`);
return primeArray.reduce((acc, val) => acc + val);
}
for (let i = num - 1; i > 1; i--){
let primeQuery = (num % i === 0)
//console.log(`${num} divides by ${i} with no remainder: ${primeQuery}`)
primeCheck = (num % i === 0)? primeCheck + 1 : primeCheck;
if (primeCheck > 0) {
console.log(`${num} is not prime`)
sumPrimes(num - 1)
}
if (i === 2 && primeCheck === 0){
primeArray.push(num);
console.log(`${num} is prime!!!`)
console.log(`Array of primes is now : ${primeArray}`)
console.log("---------------------")
sumPrimes(num - 1)
}
}
}
console.log(sumPrimes(10));
```

```
**Your browser information:**
```

User Agent is: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15`

**Challenge:** Sum All Primes

**Link to the challenge:**