Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ECMA 6 - Test iterators and for-of #130

Open
emravera opened this issue Apr 16, 2018 · 0 comments
Open

ECMA 6 - Test iterators and for-of #130

emravera opened this issue Apr 16, 2018 · 0 comments

Comments

@emravera
Copy link
Collaborator

Generate a test suite for:

let fibonacci = {
    [Symbol.iterator]() {
        let pre = 0, cur = 1
        return {
           next () {
               [ pre, cur ] = [ cur, pre + cur ]
               return { done: false, value: cur }
           }
        }
    }
}

for (let n of fibonacci) {
    if (n > 1000)
        break
    console.log(n)
}

More info at: http://es6-features.org/#IteratorForOfOperator

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant