Based my work on a paragraph here…

This is the first time I’ve felt compelled to post my solution. Since I’m following tutorials they are usually not significantly different to be covering any new territory, but I got out in the weeds on this one and some how still made it back, 233 lines later…

```
//helper functions
function isItEven(n) {
// Try 2: is an even number and it will be divisible by 2, therefore it is not prime.
if (n === 1) {
return;
}
if (n === 2) {
return n;
}
if (n % 2 !== 0) {
console.log(n);
return n;
}
} //end of isItEven
function isItTHREED(n) {
// [based my work off a paragraph here..](https://www.thoughtco.com/how-to-determine-number-is-prime-2312518)
if (n === 3) {
return n;
}
// Try 3. Take the number, and add the digits up, when those digits are divisible by 3, the number is not prime.
// Take 2469, those digits add up to 21, and 21 is divisible by 3, therefore 2469 is not a prime number.
console.log("3s", n);
n = n.toString();
var digitONE = Number(n.charAt(0));
var digitTWO = Number(n.charAt(1));
var digitTHREE = Number(n.charAt(2));
var digitFOUR = Number(n.charAt(3));
console.log("digits", digitONE);
console.log("digits", digitTWO);
console.log("digits", digitTHREE);
console.log("digits", digitFOUR);
var testing = digitONE + digitTWO + digitTHREE + digitFOUR;
console.log(testing);
n = Number(n);
if (testing % 3 !== 0) {
return n;
}
} //end of isItTHREED
function isItFOURED(n) {
// https://www.thoughtco.com/how-to-determine-number-is-prime-2312518
var fourTrap = [];
n = n.toString();
var digitLAST = Number(n.charAt(n.length));
var digitNEXTtoLast = Number(n.charAt(n.length - 1));
console.log("digits", digitLAST);
console.log("digits", digitNEXTtoLast);
var testing = digitLAST + digitNEXTtoLast;
console.log(testing);
n = Number(n);
if (testing % 4 === 0) {
fourTrap.push(n);
console.log("fourThrap", fourTrap);
}
if (testing % 4 !== 0) {
return n;
}
} //end of isItFOURED
function isItFIVED(n) {
if (n === 5) {
return n;
}
var fifthTrap = [];
var fifthLast = n.toString();
console.log(n);
var digitLAST = Number(fifthLast.charAt(fifthLast.length - 1));
var testing = digitLAST;
console.log("testLOG", testing);
n = Number(n);
if (testing === 5 || testing === 0) {
fifthTrap.push(n);
console.log("traptFIVE", fifthTrap);
}
if (testing !== 5 && testing !== 0) {
return n;
}
} //end of isItFIVED
function isItSeveneD(n) {
// Try 2: is an even number and it will be divisible by 2, therefore it is not prime.
if (n === 7) {
return n;
}
if (n % 7 !== 0) {
console.log(n);
return n;
}
} //end of isItSeveneD
function isItElevened(n) {
// Try 2: is an even number and it will be divisible by 2, therefore it is not prime.
if (n === 11) {
return n;
}
if (n % 11 !== 0) {
console.log(n);
return n;
}
} //end of isItElevened
function isIt13th(n) {
// Try 2: is an even number and it will be divisible by 2, therefore it is not prime.
if (n === 13) {
return n;
}
if (n % 13 !== 0) {
console.log(n);
return n;
}
} //end of isIt13th
function isIt17th(n) {
// Try 2: is an even number and it will be divisible by 2, therefore it is not prime.
if (n === 17) {
return n;
}
if (n % 17 !== 0) {
console.log(n);
return n;
}
} //end of isIt17th
function isIt19th(n) {
// Try 2: is an even number and it will be divisible by 2, therefore it is not prime.
if (n === 19) {
return n;
}
if (n % 19 !== 0) {
console.log(n);
return n;
}
} //end of isIt19th
function isIt23rd(n) {
// Try 2: is an even number and it will be divisible by 2, therefore it is not prime.
if (n === 23) {
return n;
}
if (n % 23 !== 0) {
console.log(n);
return n;
}
} //end of isIt23rd
function isIt29(n) {
// Try 2: is an even number and it will be divisible by 2, therefore it is not prime.
if (n === 29) {
return n;
}
if (n % 29 !== 0) {
console.log(n);
return n;
}
} //end of isIt29
function isItThirtyONED(n) {
if (n === 31) {
return n;
}
if (n % 31 !== 0) {
console.log(n);
return n;
}
} //end of isItThirtyONED
function sumPrimes(num) {
var primes = [];
var i = 1;
while (i < num + 1) {
primes.push(i);
i++;
}
console.log("primes", primes);
primes = primes.filter(isItEven);
// Try 3. Take the number, and add the digits up, when those digits are divisible by 3, the number is not prime.
// Take 2469, those digits add up to 21, and 21 is divisible by 3, therefore 2469 is not a prime number.
primes = primes.filter(isItTHREED);
console.log("isItTHREED", primes);
// Try fours.
primes = primes.filter(isItFOURED);
console.log("isItFOURED", primes);
// Try fives
primes = primes.filter(isItFIVED);
console.log(primes);
// Try 7
primes = primes.filter(isItSeveneD);
console.log(primes);
// Try 11
primes = primes.filter(isItElevened);
console.log(primes);
// Try 13
primes = primes.filter(isIt13th);
console.log(primes);
// Try 13
primes = primes.filter(isIt17th);
console.log(primes);
// Try 19
primes = primes.filter(isIt19th);
console.log(primes);
// Try 23
primes = primes.filter(isIt23rd);
console.log(primes);
// Try 29
primes = primes.filter(isIt29);
console.log(primes);
// Try 31
primes = primes.filter(isItThirtyONED);
console.log(primes);
//might extract the anounoum function.. may also use it to filter out evens?
var reducted = primes.reduce((total, amount) => total + amount);
num = Number(reducted);
//console.log(num);
return num;
} //sumPrimes
sumPrimes(10); // should return 17.
//sumPrimes(100); // should return 17.
//sumPrimes(977); // should return 73156.
//2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41
```