take for example a function that accepts an iterator:
```javascript
function test(name, iterable) {
try {
var iterator = iterable[Symbol.iterator]();
console.log(name,'with value for first next', iterator.next(1))
}
catch(e) {
console.error(name,'failed value for first next', e);
}
}
var arr = [1,2];
var set = new Set({first:true},{second:true});
var str = 'ab';
var gen=function*(){
yield 1;
yield 2;
};
test('array', arr);
test('set', set);
test('string', str);
test('generator', gen());
```
If I am reading the spec right (and I may not be), only the generator
should fail? The first call to gen().next(value) must have value be
undefined, and the others do not check.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss