mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2024-04-21 12:32:22 +00:00
edit generator
This commit is contained in:
@@ -61,4 +61,17 @@ for (var n of it) {
|
||||
}
|
||||
|
||||
```
|
||||
在ES6中,数组本身就具有iterator接口。
|
||||
|
||||
```javascript
|
||||
|
||||
const arr = ['red', 'green', 'blue'];
|
||||
|
||||
for(let v of arr) {
|
||||
console.log(v);
|
||||
}
|
||||
\\ red
|
||||
\\ green
|
||||
\\ blue
|
||||
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user