Generator - yield
is used to pause and resume a generator function
converting a generator to an array (using Array.from
) resumes the generator until all values are received
after the first generator.next()
call
the value is "hello"
and done
is false
after the second next()
call
value
is "world"
and done
is still false
after stepping past the last element, calling next()
that often
done
property equals true, since there is nothing more to iterator over
Links
Describing the `yield` keyword.
Required Knowledge
- `let` declaration (Block scope)
- creation (Generator)
- iterator (Generator)
Related Katas
Generator
- creation
- iterator
- yield expressions
- send value to a generator
- send function to a generator
return
inside a generator function
Difficulty Level
TBD
First Published
5 June 2015
Stats
6 tests to solve