HAKATEMIA
13JavaScript

For...Of Loop - Repeating an Action for Each Item in a List

Easy15MIN

What Is a For...of Loop?

In JavaScript, a for...of loop is used to iterate over the values of an iterable object, like an array.

The basic syntax is:

JAVASCRIPT
1for (let item of items) {
2  // Execute code using item
3}
  • item: A variable that represents the current element in the iteration.
  • items: An iterable object (like an array).
1 / 4
Hakatemia Pro

Learn to hack — start here

Hundreds of interactive courses, virtual labs and CTF challenges in your browser. Start a free trial — no card required.