Tell us what’s happening:
I’ve passed this test without hints though last check passes every other time
Your code so far
function sumPrimes(num) {
let arn = [];
let nar = [];
for (var i = 2; i <= num; i++) {
arn.push(i);
}
for (var j = 2; j < arn.length; j++) {
for (var k = 2; k < arn[j]; k++) {
if (Number.isInteger(arn[j] / k)) {
nar.push(arn[j]);
}
}
}
return arn.filter(item => !nar.includes(item)).reduce((a,b) => a+b,0);
}
sumPrimes(977);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-primes