Sum All Primes - Not passing test

I’ve seen a few comments on here stating they are unable to pass this test as it won’t pass the final test case. I’m also struggling now, it works fine in i originally had my isPrime function separate to the sumPrimes function, but someone mentioned to try include it in the same one, but no joy. Also, tried running the tests through both Chrome and FireFox…

Anyone know what could be wrong with my code? I know I could copy and paste another solution just to get through it, but some of these solutions still look a bit too advanced to me at present. So wanting to pass using my own logic…

Heres what I have:

function sumPrimes(num) {

  function isPrime(testVal){
    let primeCheck = []
    for(let i=1;i<=testVal;i++){    
      if(testVal % i === 0 && testVal > 1){
    return (primeCheck.length === 2) ? true : false;

 let arr = [];
 for(let i=1;i<=num;i++){
   if(isPrime(i) === true){

 return arr.reduce((a, b) => a + b, 0)


Usually when these won’t pass the final test it is because it is timing out. You’ll need to think about your algorithm and make it more efficient.