I'm a JS beginner and am having trouble understanding the difference between these types of loops.
I have a general grip over for
loops, which I have been using for some time, but I've never used the other two. I understand that do while
loops execute at least one time, then check if the condition is true. However, I don't get what's the difference between for
and while
loops. Maybe someone could show me some case scenarios in which each one is best?
Thanks a lot!
Asked
Active
Viewed 18 times
0

lwisi
- 293
- 8
- 23
-
2Does this answer your question? [What's the difference between while() and for()?](https://stackoverflow.com/questions/32562212/whats-the-difference-between-while-and-for) - while marked as a duplicate for PHP, the accepted answer seems to answer your question. – chazsolo Jul 16 '20 at 17:31
-
1Hey, thanks a lot, I checked the accepted answer on that question and it helped! Thank you so much. Should I delete this question altogether or marked it as solved? – lwisi Jul 16 '20 at 17:36