why my code is not working, is the logic wrong? I can’t pass the test.
function sumPrimes(num)
{
let arr = [];
for(let i = 2; i <= num; i++)
{
let count = 0;
for(let j = 0; j < i; j++)
{
if(j%i === 0)
{
count += 1;
}
}
if(count === 1)
{
arr.push(i);
}
}
return arr.reduce((a, b) => a + b );
}
sumPrimes(10);