# Built-in entries iterator in JavaScript

All iterables have the built-in `entries` iterator that allows you to iterate over key-value pairs. Let's test it on an array:

`let arr = ['a', 'b', 'c'];`

We get an iterator:

`let iter = arr.entries();`

And loop through it:

`for (let entry of iter) { console.log(entry); // [0, 'a'], [1, 'b'], [2, 'c'] }`

Let's perform destructuring during iteration:

`for (let [key, value] of iter) { console.log(key); // 'a', 'b', 'c' console.log(value); // 0, 1, 2 }`

Test the work of this iterator on a `Map` collection.

Test the work of this iterator on a `Set` collection.

Test the work of this iterator on a `NodeList` collection.

←→
↑
en ru