Skip to content

Commit 1d24255

Browse files
committed
added help text for genetor function
1 parent f6c9c47 commit 1d24255

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

generators.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Generators are functions which can be paused and resumed later. Function
3+
* context is saved across resumes.
4+
*/
5+
16
function* count(){
27
var start = 0;
38
while(true) {
@@ -11,4 +16,4 @@ var iterator = count();
1116
iterator.next(); //{value: 0, done: false}
1217
iterator.next(); //{value: 1, done: false}
1318
iterator.next(); //{value: 2, done: false}
14-
iterator.next(); //{value: 3, done: false}
19+
iterator.return();

0 commit comments

Comments
 (0)