Help wanted for Loops 3 skill test

Prime number function is working but the loop is repeating itself. Can anyone suggest the way to stop it?
My codepen URL :
" https://codepen.io/safna123/pen/NWNVZxN "

Hello @safna_parveen
you doing great just think about the following part of the code

for (let i=2; i<num; i++){
  if (num % i === 0){
    para.textContent += num + ' , ';
  }
}

in this inner loop you check the num is dividable by any number that lower than it so sometime there will be reminder and other time no in the case when there will be no reminder you add the num to the p element and as you know not non prime number can be divided by many number that lower than it

hope that clear the issue and if you need any help let me know and have a nice day :slight_smile:

1 Like