Lambda saysGenerators (function*) pause and resume with yield, producing values lazily.
A function* returns a generator. Each yield hands back a value and pauses until next() is called again. This makes lazy sequences, infinite streams, and custom iterators trivial — and generators are iterable, so for...of and spread consume them directly.
Power-ups you unlock
function* + yield pauses/resumes
Produces values lazily, on demand
Generators are iterable
Great for streams and custom iteration
The Mutator attacks — common mistakes
Forgetting the * on function*
Spreading an infinite generator (locks up)
Expecting code after yield to run before next()
Boss battleWrite a generator that yields 1, 2, 3 and consume it with for...of.