Sum All Primes* Help here

Sum All Primes* Help here
0

#1

Help me with this code it already work for a small number but when i use a long one doesnt wokr

Your code so far

function sumPrimes(num) {
  var number = [];
  var second = [];
  var last = [];
  for(var i = 2; i < num; i++){
    if(i % 2 !== 0 && i % 3 !== 0 && i % 5 !== 0  ){
      number.push(i);
    }
    
  }



// //  return last;
  
  number =  number.reduce(function(a, b){
    return a + b;
  });
   return number +10;
}

sumPrimes(977);

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36.

Link to the challenge:


#2

Your code only checks if numbers are divisible by 2, 3, 4, or 5. It would fail for 49, for example (49 is not prime, but it is divisible by 2, 3, 4, and 5).


#3

What should i do? I was trying everything but i dont know