Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Problem with sample program in Async Generators and Iterators article #1775
Comments
|
Hi @paroche, On javascript.info this is already included in the header which you can find here Also the tutorial shows this function in the code snippet above the one you describe. So if you want to execute the code on plunker you need to copy/paste this dependent code as well. |
|
Maybe add a note about "where to find |
|
Hi @joachimklug Yes, that's what I said in the first line of my post: "In Plunker, following Open in Sandbox link, code provided under "An example of use (shows commit authors in console):" doesn't work (because it doesn't include fetchCommits function)." @iliakan -- that would help, though I would think you would want the "Open in Sandbox" link to work. |
In Plunker, following
Open in Sandboxlink, code provided under "An example of use (shows commit authors in console):" doesn't work (because it doesn't includefetchCommitsfunction).Console shows error:
(index):9 Uncaught (in promise) ReferenceError: fetchCommits is not defined (index):9 Uncaught (in promise) ReferenceError: fetchCommits is not defined at (index):9 at (index):18Running the code directly from the
runlink in article also doesn't work. Gives error:holder-2.2.min.js:10 Uncaught TypeError: Cannot read property 'appendChild' of undefined at Object.e.run (holder-2.2.min.js:10) at holder-2.2.min.js:10 at XMLDocument.h (holder-2.2.min.js:10)Code in question:
(async () => { let count = 0; for await (const commit of fetchCommits('javascript-tutorial/en.javascript.info')) { console.log(commit.author.login); if (++count == 100) { // let's stop at 100 commits break; } } })();