Tell us what’s happening:
I don’t understand why sumPrimes(977) should return 73156 shouldn’t it return 977 since 977 is a prime number. I need help fixing my code so it returns the correct answer
**Your code so far**
function sumPrimes(num) {
let primes = [];
let count = 1;
while (count < num) {
let eq = num / count;
primes.push(eq);
count++;
}
return primes.filter(c => c % parseInt(c) == 0).reduce((p, c) => p + c);
}
sumPrimes(977);
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0
.
Challenge: Sum All Primes
Link to the challenge: