Feedback on my solution of Intermediate Algorithm Scripting - Sum All Primes

Tell us what’s happening:
Describe your issue in detail here.
i feel my code is not efficient code because it needs alot of steps to excute to come up with the solution so tell me how can i improve it ??

  **Your code so far**
function sumPrimes(num) {
let j=2;
let arr = [];
let sum =0;
while(j <= num){
  let isPrime = true;
  for(let i =2;i<num;i++){
    if((j/i)%1 == 0 && i !=j){
       isPrime = false;
  if (isPrime == true){
for(let i=0;i<arr.length;i++){
  sum += arr[i];

return sum;

  **Your browser information:**

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

Challenge: Intermediate Algorithm Scripting - Sum All Primes

Link to the challenge:

If you need a faster solution look into this
article Sieve of Eratosthenes - Wikipedia

If your code works, this is one challenge where I’d check out the solutions.

What does this mean ?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.