Skip to content

Commit 0f74827

Browse files
committed
minor fixes
1 parent bae0ef4 commit 0f74827

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

1-js/05-data-types/06-iterable/article.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ To make the `range` object iterable (and thus let `for..of` work) we need to add
3131
1. When `for..of` starts, it calls that method once (or errors if not found). The method must return an *iterator* -- an object with the method `next`.
3232
2. Onward, `for..of` works *only with that returned object*.
3333
3. When `for..of` wants the next value, it calls `next()` on that object.
34-
4. The result of `next()` must have the form `{done: Boolean, value: any}`, where `done=true` means that the iteration is finished, otherwise `value` is the next value.
34+
4. The result of `next()` must have the form `{done: Boolean, value: any}`, where `done=true` means that the loop is finished, otherwise `value` is the next value.
3535

3636
Here's the full implementation for `range` with remarks:
3737

@@ -45,10 +45,10 @@ let range = {
4545
range[Symbol.iterator] = function() {
4646

4747
// ...it returns the iterator object:
48-
// 2. Onward, for..of works only with this iterator, asking it for next values
48+
// 2. Onward, for..of works only with the iterator object below, asking it for next values
4949
return {
5050
current: this.from,
51-
last: this.to,
51+
last: this.to,
5252

5353
// 3. next() is called on each iteration by the for..of loop
5454
next() {
@@ -270,7 +270,7 @@ for (let char of str) {
270270
alert(chars);
271271
```
272272

273-
...But it is shorter.
273+
...But it is shorter.
274274

275275
We can even build surrogate-aware `slice` on it:
276276

0 commit comments

Comments
 (0)