Skip to content

Iterator遍历器这一小节中发现个小错误 #8

@chwech

Description

@chwech

在最后的Generator返回的也是Iterator对象这段中的示例代码

console.log(h.next())  // { value: 100, done: false }
console.log(h.next())  // { value: 200, done: false }
console.log(h.next())  // { value: 300, done: false }
console.log(h.next())  // { value: undefined, done: true }

第三个next执行完成done应该是true

console.log(h.next())  // { value: 300, 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