Created
February 1, 2020 17:36
-
-
Save workmad3/78b361f7ca0800610f8f5606c0be3a14 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var squaresTo = (limit) => { | |
var iterator = { | |
value: 1, | |
nextDelta: 3, | |
done: false, | |
next: () => { | |
return { | |
value: this.value + this.nextDelta, | |
nextDelta: this.nextDelta + 2, | |
done: (this.value + this.nextDelta) <= limit, | |
next: this.next, | |
} | |
} | |
} | |
} | |
var test = [ ...squaresTo(100) ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment