1function sumPrimes(num) {
2 let i = 1;
3 let sum = 0;
4 while (i <= num) {
5 if (isPrime(i)) {
6 sum += i;
7 }
8 i++;
9 }
10 return sum;
11}
12//function to check if a number is prime or not
13function isPrime(x) {
14 for (let i = 2; i < x; i++) {
15 if (x % i === 0) return false;
16 }
17 return x !== 1 && x !== 0;
18}
19//test here
20sumPrimes(10);