Skip to content

Instantly share code, notes, and snippets.

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