Intermediate Algorithm Scripting - Sum All Primes

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

I am not getting why is not passing the test.
function sumPrimes(num) {
  function checkPrimes(number) {
    for(let i = 2; i < number; i++) {
      if(number % i === 0) {
       return false
      }
      return true
    }
  }
  let result = 0;
    for(let j = 2; j <= num; j++) {
      if(checkPrimes(j)) {
        result += j
      }
    }
    return result
}

console.log(sumPrimes(10));

Your browser information:

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

Challenge: Intermediate Algorithm Scripting - Sum All Primes

Link to the challenge:

9 is not a prime number. 2 is a prime number. Your prime checking function reports the wrong result for these two numbers.