Skip to content

Repeating with a for loop

  • A loop runs the same block many times, so you don't repeat yourself.
  • for (let i = 1; i <= 5; i++) { ... } has three parts: start i = 1, test i <= 5, step i++.

for (let i = 0; i < 4; i++) starts once, tests before each pass and updates after the body

Handout

Log in or create account

IGCSE, A-Level & AP