Skip to content

Instantly share code, notes, and snippets.

@workmad3
Created February 1, 2020 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save workmad3/78b361f7ca0800610f8f5606c0be3a14 to your computer and use it in GitHub Desktop.
Save workmad3/78b361f7ca0800610f8f5606c0be3a14 to your computer and use it in GitHub Desktop.
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