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
mdn
docs
Describing the `yield` keyword.