Can someone please give me guidance on getting the primenumbers here? This is homework so I don\'t want the answer but some pointers would be greatly appreciated. It\'s real
In your if statement you got
if(n%i !==0 && n%2 !==0 && n%3 !== 0)
you for loop is going till i >= 2, so the n%2 !== 0 is useless, when i = 2, your if would look like:
if(n%2 !==0 && n%2 !==0 && n%3 !== 0)
Thats 2x the same check, the same is for n%3, its already checked :).
you should keep a bool to check the n%i !== 0, if it never reach this it's a prime.
Good luck with your homework :).