Sum All Primes EXACT RESULTS BUT FAIL TESTS

Tell us what’s happening:

Hi,My code produces the same exact results on VS yet it doesn’t pass the tests.

Your code so far


function sumPrimes(num) {
 let AllNo=[]
 let DivNo=[]
 let PrimeNo=[]
 for(let i=2;i<=num;i++)
 {AllNo.push(i)}
 console.log(AllNo)
 for(let j=1;j<AllNo.length;j++)
 {
   for(let k=j;k>=0;k--)
   {DivNo.push(AllNo[k])}
   console.log(DivNo,"Before Filteration")
   DivNo.shift();
   DivNo=DivNo.filter((x)=>AllNo[j]%x===0)
   console.log(DivNo,"After Filteration")
   if(DivNo.length===0)
   {PrimeNo.push(AllNo[j])}
   else{DivNo=[]}
 }
 PrimeNo.push(2);
 console.log(PrimeNo,"Prime Numbers")
 return PrimeNo.reduce((x,y)=>x+y)
}

sumPrimes(10);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-primes

FCC has infinite loop protection to prevent your browser from crashing if you create an infinite loop or infinite recursion. This protection is timer-based, so if your code is inefficient it may trigger the infinite loop protection even if it would eventually terminate. This may be the case with your solution.

After reading what u said…i tried removing the console.log() statements and my code worked !..the output of so many numbers was just too much for the website tester.