the iterator
- an array has an iterator, which is a function
- can be looped with
for-of
, which expects an iterable
the iterator protocol
- calling
next()
on an iterator returns an object according to the iterator protocol - the after-last element has done=true