javascript-tutorial / javascript-tutorial/en.javascript.info
Problem with sample program in Async Generators and Iterators article
- Dominant language
- HTML
- Stars
- 25.5k
- Forks
- 4k
- PR merge metrics
- No merged PRs in 30d
Description
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).
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):18
Running the code directly from the `run` link 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;
}
}
})();
Contributor guide
No contributing guide indexed for this repository
Research direction
Open the Async Generators and Iterators article and inspect the “An example of use” snippet plus its Open in Sandbox and run links. Reproduce the reported errors, then update the example or linked samples so fetchCommits is available and the code runs without the Holder error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100