Iterator
Object with .next()
, .send(obj)
and .close()
methods.
It is iterable via for...of
and for...in
loops. Both ways act the same, i.e. call .next()
repeatedly until it throws a StopIteration
.
Generator expression
Iterator created via e.g. (x*2 for (x of array))
.