minor
This commit is contained in:
parent
74e603ad3f
commit
f759f38544
1 changed files with 1 additions and 1 deletions
|
@ -343,7 +343,7 @@ generator.next(4); // --> pass the result into the generator
|
|||
|
||||

|
||||
|
||||
1. The first call `generator.next()` is always without an argument. It starts the execution and returns the result of the first `yield "2+2=?"`. At this point the generator pauses the execution (still on that line).
|
||||
1. The first call `generator.next()` should be always made without an argument (the argument is ignored if passed). It starts the execution and returns the result of the first `yield "2+2=?"`. At this point the generator pauses the execution, freezing itself on the line `(*)`.
|
||||
2. Then, as shown at the picture above, the result of `yield` gets into the `question` variable in the calling code.
|
||||
3. On `generator.next(4)`, the generator resumes, and `4` gets in as the result: `let result = 4`.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue