JavaScript Tutorial

The language for programming web pages.

JS Loops

JavaScript Loops

Loops execute a block of code multiple times. JavaScript supports several loop types.

Loop Types:

  • for — Known number of iterations
  • while — While condition is true
  • do...while — Runs at least once
  • for...of — Iterate over arrays/strings
  • for...in — Iterate over object keys
  • forEach() — Array method loop

Try It Yourself

Edit the code below and click Run to see the result live.

Source Code
Result
Topics