Count and Repeat
Use loops to repeat code and count.
Some tasks feel like a chore when done manually over and over. What if your code could repeat something for you? That’s where loops come in!
Loops tell JavaScript to run a block of code again and again, until you say stop.
Goal
You will learn to:
Use
for
andwhile
loops.Understand when to use each.
Automate repetition in your program.
for
loop—count up
A for
loop is great when you know how many times you want something to repeat.
Get hands-on with 1400+ tech skills courses.