Iterator function in JavaScript

All iterables have a special structure called iterator. An iterator is a function that allows you to iterate over an object.

Let's look at an array example:

let arr = [1, 2, 3];

The iterator function for any iterable object is stored with a key in the form of the well-known symbol Symbol.iterator:

let func = arr[Symbol.iterator];

We can make sure that the function is stored under this key (but its code will be hidden from us by the browser):

console.log(func); // the function

Check the different types of iterables you know to see if they contain the described function.