Please enable JavaScript to use CodeHS

Chapter 2

JavaScript Control Structures

2.5 For Loops

For Loop Example

Variations on the Basic For Loop


Count By Twos

For Loop Sum

Check Your Understanding

  1. Incorrect Correct No Answer was selected Invalid Answer

Exercise: Chalkboard


Term Definition
Loop A loop is a way to repeat code in your program.
For Loop A for loop lets us repeat code a **fixed number of times**.
JavaScript Documentation Documentation for the syntax and objects in Javascript that we use on CodeHS.
Iterate A single run through the instructions contained a loop
Increment To add to or increase
DRY Principle Don't repeat yourself: try to simplify your code and avoid repeating code unnecessarily.