Tell us what’s happening:
Describe your issue in detail here.
**Your code so far**
function sumPrimes(max) {
let sieve = [], i, j,total = 0,primes = [];
for (i = 2; i <= max; i++) {
console.log(sieve[i]);
if (!sieve[i]) {
// i has not been marked -- it is prime
primes.push(i);
for (j = i << 1; j <= max; j += i) {
sieve[j] = true;
}
}
}
// console.log(primes);
primes.forEach(x=>total += x);
return total;
}
sumPrimes(10);
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36
Challenge: Sum All Primes
Link to the challenge: