Sum All Primes numbers

Tell us what’s happening:
failed to passed the 3rd one.Whats wrong is with my code can anyone explain?

Your code so far

function sumPrimes(num) {
  var array = [];
    for(var i=2;i<num; i++){
      for(var j=2; j<=i ; j++){
       if(i===j){
        array.push(i);
}
if(i%j===0){
break;
    }
  }
}
return array.reduce(function(x,y){return x+y;});
}

sumPrimes(977);

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36.

Link to the challenge:
https://www.freecodecamp.org/challenges/sum-all-primes

Consider which numbers gets checked with your outer for loop for(var i=2;i<num; i++){ (977 is a prime).

@Logiar thanks i forgot to put = before num.Now its working; 
1 Like