Sum All Primes -Problem

sumPrimes(977) should return 73156 but i get 34915.why.

function sumPrimes(num) {
  let res = 0;
  for(let i=2;i<=num;i++){
    let isPrime = true;
    for(let j=2;j<i;j++){
      if(i%j == 0){
        isPrime = false;
      }
    }
    if(isPrime){
      res+=i;
    }

  }
  console.log(res);
  return res;

}

sumPrimes(977);

thank,bro.

Your code takes too long and fcc test runner has an infinite loop protection. You need to optimize your code.

thank you very much,bro:sunny: