edit generator

This commit is contained in:
ruanyf
2014-04-23 19:18:54 +08:00
parent 78641c9cd2
commit a55a68cbb1
2 changed files with 15 additions and 2 deletions
+13
View File
@@ -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
```