The Difference Between For Loops and While Loops in JavaScript

Alex Richards
Level Up Coding
Published in
5 min readNov 5, 2019

--

Something that’s extremely useful in the land of development is for loops and while loops. Loops do exactly what they sound like, they allow us to run the same code over and over again until a stopping condition is met. This can be extremely useful for all kinds of things in coding and is one of the fundamental building blocks of web development. Loops are also a great way to refactor your code and make it much smaller in size! Today we’ll look at the three most basic ways to make a loop in JavaScript as well as when to use which one over the other.

--

--