Created
June 2, 2018 15:12
-
-
Save dg92/1eb82869d72ad6b91460341bb9164307 to your computer and use it in GitHub Desktop.
This file contains 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
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