Skip to content

《简述一下 Generator 函数》这篇里实例的结果有点小问题 #9

Description

@CatherineYF
function* gen(x) {
  var y = yield x + 2;
  return y;
}

var g = gen(1);
g.next() 
g.next(2) //  这里的结果是return返回的,done应该是true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions