> Why not? The generator would switch on sent value, in a loop.
Well, let's say we have an iterator that does nothing once, returns what
was sent to it the first 5 times and then is done:
```js
function* gen(){
var res = yield;
for(var i = 0; i < 5; i++){
res = yield res;
}
}
var iter = gen(), res = {}, i = 1;
iter.next();
do {
res = iter.next(i++);
console.log(res.value);
} while(!res.done);
```
How would you clone that with a switch?
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss