Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/400.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用ES7 async和异步生成器函数从for…on循环返回时会发生什么?_Javascript_Traceur_Ecmascript Next - Fatal编程技术网

Javascript 使用ES7 async和异步生成器函数从for…on循环返回时会发生什么?

Javascript 使用ES7 async和异步生成器函数从for…on循环返回时会发生什么?,javascript,traceur,ecmascript-next,Javascript,Traceur,Ecmascript Next,我正在绞尽脑汁思考下面的例子: 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: "T

我正在绞尽脑汁思考下面的例子:

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);
  });

循环的
for…中的
返回
语句是否从表示
项目#条
输出的观察者处取消订阅?

@Tushar在本用例中似乎需要
for…on
<代码>for…of
只报告一个错误;而
实际上是有效的;但是我想了解一些内部信息。@Tushar如果您在页面的“选项”下选择“实验”模式,您可以看到
for…on
在这里起作用。我在
for…on
上找不到任何文档。你能补充一些参考资料吗?