# Iterating over an array with a for-of loop in JavaScript

The loop `for-of` allows you to sequentially iterate over the elements of arrays. It has the following syntax:

`for (let variableForElement of array) { /* The elements of the iterated array will sequentially fall into the variableForElement. */ }`

Let's look at an example. Let the following array be given:

`let arr = [1, 2, 3, 4, 5];`

Loop through this array and output its elements to the console:

`for (let elem of arr) { console.log(elem); }`

Print to the console all the elements of the following array:

`let arr = ['a', 'b', 'c', 'd', 'e'];`
← →
↑
en ru