add docs/iterator

This commit is contained in:
ruanyf
2014-04-23 04:10:50 +08:00
parent aff04f58d7
commit 98316a7272
+13
View File
@@ -49,3 +49,16 @@ it.next().value // '2'
// ...
```
一个对象只要具备了next方法,就可以用for...of循环遍历它的值。
```javascript
for (var n of it) {
if (n > 5)
break;
console.log(n);
}
```