Sum All Primes - different answers

Tell us what’s happening:

Hello, I have a problem and I don’t know it’s my fail or freeCodeCamp bug, in freeCodeCamp console my code prints: 64615 (bad answer and test failed), but with same code my browser’s console prints: 73156 (good answer).

Anyone can assist me?


Your code so far

function sumPrimes(num) {
  var answer = 0;
  for (let i = 1; i <= num; i++) {
    var c = 0;
    for (let j = 1; j <= i; j++) {
      if (i % j == 0) {
    if (c == 2) {
      answer = answer + i;
  return answer;


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0.

Link to the challenge:

Freecodecamp has an infinite loops protection that will stop a loop from executing if it is needing too much time - Probably you are triggering that. You need code that requires less time to execute.