Skip to content

Commit 8a3e1fd

Browse files
committed
minor
1 parent 7e32cf2 commit 8a3e1fd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

1-js/12-generators-iterators/1-generators/article.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -347,16 +347,16 @@ generator.next(4); // --> pass the result into the generator
347347
2. Then, as shown at the picture above, the result of `yield` gets into the `question` variable in the calling code.
348348
3. On `generator.next(4)`, the generator resumes, and `4` gets in as the result: `let result = 4`.
349349

350-
Please note, the outer code does not have to immediately call`next(4)`. It may take time to calculate the value. That's not a problem: the generator will resume when the call is made.
350+
Please note, the outer code does not have to immediately call`next(4)`. It may take time. That's not a problem: the generator will wait.
351351

352-
This is also a valid code:
352+
For instance:
353353

354354
```js
355355
// resume the generator after some time
356356
setTimeout(() => generator.next(4), 1000);
357357
```
358358

359-
As we can see, unlike regular functions, generators and the calling code can exchange results by passing values in `next/yield`.
359+
As we can see, unlike regular functions, a generator and the calling code can exchange results by passing values in `next/yield`.
360360

361361
To make things more obvious, here's another example, with more calls:
362362

figures.sketch

-1.41 KB
Binary file not shown.

0 commit comments

Comments
 (0)