MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/JavaScriptTips/comments/uog6cr/function_help/i8e7w2d/?context=3
r/JavaScriptTips • u/AcanthocephalaDue494 • May 13 '22
4 comments sorted by
View all comments
2
In the above function I’m trying to find the prime numbers between 2 and the entered number n. When I carry out this function I always just end up with 2 in my array. Am I missing something? It’s like it hits two then the loop ends
6 u/pzoxicuvybtnrme May 13 '22 Return numbers needs to be outside the for loop otherwise it's being called after one iteration and ends the loop 4 u/AcanthocephalaDue494 May 13 '22 Wow that’s crazy, it’s really the smallest things sometimes. Thank you!
6
Return numbers needs to be outside the for loop otherwise it's being called after one iteration and ends the loop
4 u/AcanthocephalaDue494 May 13 '22 Wow that’s crazy, it’s really the smallest things sometimes. Thank you!
4
Wow that’s crazy, it’s really the smallest things sometimes. Thank you!
2
u/AcanthocephalaDue494 May 13 '22
In the above function I’m trying to find the prime numbers between 2 and the entered number n. When I carry out this function I always just end up with 2 in my array. Am I missing something? It’s like it hits two then the loop ends