> For the complete documentation index, see [llms.txt](https://april.gitbook.io/learning-js/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://april.gitbook.io/learning-js/chapter-12./12.2/12.2.1-yield.md).

# 12.2.1 yield 표현식과 양방향 통신

* 호출자가 제너레이터에 정보를 전달할 수 있음
* 제너레이터는 그 정보에 따라 자신의 동작 방식 자체를 바꿀 수 있음

```javascript
  function* interrogate() {
    const name = yield "What is your name?";
    const color = yield "What is your favorite color?";

    return `${name}'s favorite color is ${color}.`;
  }

  const it = interrogate();
  it.next(); // {value: "What is your name?", done: false}
  it.next('Ethan'); // {value: "What is your favorite color?", done: false}
  it.next('orange'); // {value: "Ethan's favorite color is orange.", done: true}
```
