Tell us what’s happening:
hello guys my code is working just fine in repl.it but not here for the last step
Your code so far
function sumPrimes(num) {
let arr = []
let pri = []
for (let i = 2 ; i <= num ; i++){
arr.push(i)
}
for (let i = 0 ; i<arr.length ;i++){
for (let j = 0 ; j<arr.length ;j++){
if (arr[i]%arr[j] === 0 && arr[i] !== arr[j]){
delete arr[i]
}
}
}
return arr.reduce(function (a,b){return a+b});
}
sumPrimes(10);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-primes/