Created
October 4, 2018 15:32
-
-
Save hg-pyun/a4f2da306d9f6152efda23b217402444 to your computer and use it in GitHub Desktop.
Revisions
-
hg-pyun created this gist
Oct 4, 2018 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ function* idMaker(){ var index = 0; while(index < 3) yield index++; } const gen = idMaker(); console.log(gen.next().value); // 0 console.log(gen.next().value); // 1 console.log(gen.next().value); // 2 console.log(gen.next().value); // undefined // ...