Question: Im not understand the idea, wrong was happened in this code:

[![Image Code](https://i.stack.imgur.com/hol2A.png)](https://i.stack.imgur.com/hol2A.png)

Output always undefined for first item...(Also if I set another yieldData5.next(...) after last line of code, it will be print on console

(undefined

bye : taher

undefined)

thanks,

Answer: 
> 
> Output always undefined for first item
> 
> 
> 

You are not passing anything to the function, so `i` is `undefined` and therefore `yield i;` is equivalent to `yield undefined;`. You are explicitly yielding `undefined` from the function, and that's what you see. 

---

If your question is how to reference the value passed to the first call of `.next`, the answer is unfortunately: You can't.

[This is being addressed in the next version of ECMAScript](https://github.com/allenwb/ESideas/blob/master/Generator%20metaproperty.md).
Try:

```
let yieldData5 = collection_name5({index: 0, masg: 'Hi');
console.log(collection_name5.next({index: 2, masg: 'bye').value);

```