for-loops, continued
Learn how to repeat a set of code as many times as you like, without using functions. For-loops are a fundamental part of every programming language. We'll see how to write them and how to use them with arrays.
We'll cover the following...
Refactoring our Code
For-loops are one of the few places with a single letter name is acceptable. Instead of index
, it’s common practice to use i
or j
. Let’s refactor our code from the previous lesson.
Press + to interact
for(let i = 0; i < 10; i = i + 1) {console.log(i);}
It’s also common to see ...