Javascript
JavaScript Fundamentals -- Looping in JavaScript
  •  

for Loops

PRO

for Loops are great for looping over code as many times as you'd like. You get to determine how long the code stays in the loop, and there is great flexibility with this loop. You can loop over each element in an array, you can loop over an addition function 3 times, you can loop over the numbers 1 through 10 and use the even numbers, or anything else you can think of.

This loop may look familiar if you have experience in another programming language. It's very similar to those other languages. for loops are great when you need to repeat code. It allows you to write and maintain the code once but use it multiple times.

For more information on for loops, read this blog post.