The iterator, as the name suggests, lets you iterate over a collection. To be able to do so, the collection needs to implement an iterable interface. In JavaScript, there are no interfaces, hence the iterator simply implements a single function.
"An object is an iterator
when it knows how to access items from a collection one at a time, while keeping track of its current position within that sequence. In JavaScript an iterator is an object that provides a next method which returns the next item in the sequence. This method returns an object with two properties: done and value."
- JavaScript guide on MDN web docs
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators
The ...