Learn
Loops
Looping by hand
Before we jump into writing a loop, let’s write the result of a loop, so that we can better understand how loops work.
Instructions
1.
Write an array and set it equal to a variable named vacationSpots
. Inside of this array, list three places you’d like to visit.
2.
Next, console.log
each item in vacationSpots
on a separate line. To do this, list out each item using property access.
3.
Nice work, that wasn’t too hard, but imagine if our vacation list had 100 places on it. This would be an extremely tedious task!
Let’s make this easier with a for
loop.