Where argument of first next() call goes? [duplicate]
问题 This question already has answers here : In ES6, what happens to the arguments in the first call to an iterator's `next` method? (3 answers) Closed 3 years ago . I have a simple generator function function *generate(arg) { console.log(arg) for(let i = 0; i < 3;i++) { console.log(yield i); } } Then I init the generator and trying to print values in console: var gen = generate('arg'); //doesn't print gen.next('a'); // prints 'arg' gen.next('b'); // prints 'b' gen.next('c'); // prints 'c' // ...