3

我正在努力思考以下示例中发生的情况:

class Project {
  async foo(input) {
    for (let barOutput on this.bar(input)) {
      // what happens on the following line?
      return barOutput.id;
    }
  }

  async *bar(input) {
    yield {
      id: input.id,
      title: "Test"
    };
  }
}

new Project().foo()
  .then(result => {
    console.log(result);
  });

return循环内的语句是否for...of取消订阅代表输出的观察者Project#bar

4

0 回答 0