# Iterables in JavaScript

Any object that can be iterated through the `for of` loop is called iterable.

Arrays are one of the special cases of iterable objects:

`let arr = [1, 2, 3]; for (let elem of arr) { console.log(elem); }`

`Map` collections are also iterable objects:

`let map = new Map(); map.set('a', 1); map.set('b', 2); map.set('c', 3); for (let elem of map) { console.log(elem); }`

`NodeList` collections are also iterable objects:

`let elems = document.querySelectorAll('p'); for (let elem of elems) { console.log(elem); }`

In addition, JavaScript allows you to make anything iterable. There are special tricks for this that we will study in the following lessons:

`let obj = {a: 1, b: 2, c: 3}; // here are some tricky tricks for (let elem of obj) { // can be iterated console.log(elem); }`

Give more examples of entities you know that are iterable objects.

←→
↑
en ru