This function takes a number argument and returns the sum of all prime numbers up to that argument. It only works up to a certain number and I’m wondering if its just that the calculations get too hefty for the computer or if something changes about the execution of the code at higher numbers. I’m interested in any input.

```
function sumPrimes(num) {
// Assign an empty array for prime numbers
let primeArray = [];
// Generate numbers up to the user provided input
for(let i = 2; i <= num; i++){
/*Assign an empty array to store the number of times "i" can be divided without any remainder*/
let numOfDivisors = [];
/*Loop through each possible number that "i" can be divided by and push a 1 for each time that that it divides through with no remainder*/
for(let j = 1; j <= i; j++){
if(i%j === 0){
numOfDivisors.push(1);
}
}
// Push each number that has only 2 divisors to the prime number array
if(numOfDivisors.length === 2){
primeArray.push(i);
}
}
// Add all of the values in the array together using .reduce()
return primeArray.reduce((acc,curr) => acc + curr)
}
console.log(sumPrimes(1000));
```