Skip to content

Instantly share code, notes, and snippets.

@dg92
Created June 2, 2018 12:13
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 dg92/c7c4c6028a25f3610d14096ae1b9b962 to your computer and use it in GitHub Desktop.
Save dg92/c7c4c6028a25f3610d14096ae1b9b962 to your computer and use it in GitHub Desktop.
const range = {
start: 1,
end: 5,
[Symbol.iterator]() {
this.current = this.start;
return this;
},
next() {
if (this.current <= this.end) {
return { done: false, value: this.current++ };
} else {
return { done: true };
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment