Created
June 29, 2020 01:59
-
-
Save Alamin02/450691c59541e71e897d0b77cba27e81 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
function* indexMaker() { | |
var index = 0; | |
while (true) | |
yield index++; | |
} | |
const indexGenerator = indexMaker(); | |
console.log(indexGenerator.next().value); // 0 | |
console.log(indexGenerator.next().value); // 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment