Bug at Sum All Primes Challenge?

Hello coders!

I am trying to solve challenge with Prime Numbers" Intermediate Algorithm Scripting: Sum All Primes".

my code is:

function sumPrimes (num){
var arrOfNum = createArrOfNum(num);
var arrOfPrimes = [];
for (var i = 0; i < arrOfNum.length; i++){
var numToTest = arrOfNum[i];
arrOfPrimes.push(isAprimeNum(numToTest));
}
var sumP = sum(arrOfPrimes);
var num = sumP - 1; // while 1 is not a Prime Number
return (num);
}

function createArrOfNum (num){
var arrOfNum = [];
for (var i = 1; i <= num; i++){
	arrOfNum.push(i);
}
return arrOfNum;
}

function isAprimeNum(num){
var arrOfTestNum = createArrOfTestNum(num);
var flag = true;
	for (var k = 0; k < arrOfTestNum.length; k++) {
	var remainder = num % arrOfTestNum[k];
		if (remainder == 0){
    	flag = false;
    	}
	}
if (flag == true){
return num;
}else{
return 0;
}
}

function createArrOfTestNum (num){
var arrOfTestNum = [];
var lastTestNum = num - 1;
for (var j = 2; j <= lastTestNum; j++){
	arrOfTestNum.push(j);
}
return arrOfTestNum;
}

function sum (arrOfPrimes){
var sum = 0;
for (var j = 0; j < arrOfPrimes.length; j++){
sum += arrOfPrimes[j];
}
return sum;
}

I wrote the code at js.do . When I tested it at js.do, everything was ok.
When I tested it at freeCodeCamp with the number 977 the test failed.

Where is my mistake?

Is it problem of new FCC platform?

Honestly these updates are not user-friendly.

I am looking for prompt help.

sincerely yours,
Maria

I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

markdown_Forums

Damn… that’s a big code. Anyway, your code evaluates to correct answer, the only problem is that you might be using Firefox, try Chrome it will pass the test.

https://www.youtube.com/watch?v=2p3kwF04xcA&ab_channel=Socratica best video on the net for how to go about dealing with prime numbers like a pro