Sum of the primes

I’m not sure why the sum of all primes is different fro the test…
sumPrimes(10) should return a number. checks
sumPrimes(10) should return 17. checks
sumPrimes(977) should return 73156, but mines returns 72179

Any help is much appreciated

function sumPrimes(num) {

var primes = [];

 function isPrime (number) {
   for (var i = 2; i<number; i++) {
     if(number%i === 0) 
     {return false;}     
   return true;
  for(var j=2; j<num; j++) {
    if(isPrime(j)) {

function add (a , b) {
    return a + b;
  var result = primes.reduce(add)
 return result;

Why put all the values in an array and then sum them does not add correctly? this is wierd,.

What am I missing?