minor fixes
This commit is contained in:
parent
2aa7e5539a
commit
a9c170a3ad
1 changed files with 1 additions and 1 deletions
|
@ -293,7 +293,7 @@ alert( str.slice(1, 3) ); // garbage (two pieces from different surrogate pairs)
|
|||
Objects that can be used in `for..of` are called *iterable*.
|
||||
|
||||
- Technically, iterables must implement the method named `Symbol.iterator`.
|
||||
- The result of `obj[Symbol.iterator]` is called an *iterator*. It handles the further iteration process.
|
||||
- The result of `obj[Symbol.iterator]()` is called an *iterator*. It handles the further iteration process.
|
||||
- An iterator must have the method named `next()` that returns an object `{done: Boolean, value: any}`, here `done:true` denotes the end of the iteration process, otherwise the `value` is the next value.
|
||||
- The `Symbol.iterator` method is called automatically by `for..of`, but we also can do it directly.
|
||||
- Built-in iterables like strings or arrays, also implement `Symbol.iterator`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue