JS Lesson 4: getGithubInfo should not return the xmlhttp object
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 32/100
- Issue type
- Refactor
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- documentation
Research direction
Start with js/lesson4/tutorial.md and inspect the getGithubInfo example and its surrounding lesson context. Resolve the intended success and failure return contract with maintainers, then update the tutorial so the example no longer exposes the XMLHttpRequest object and clearly shows the resulting behavior.
Written by the indexing model from the issue text.
Description
Where
The tutorial https://github.com/codebar/tutorials/blob/gh-pages/js/lesson4/tutorial.md
What
The code block
function getGithubInfo(username) {
var url = 'https://api.github.com/users/' + username;
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('GET', url, false);
xmlhttp.send();
return xmlhttp;
}
returns the xmlhttp object. I would argue that this is bad practice and the function should return only the data or a signifier of failure, for example throwing an error. The reason I think this is bad practice is that it as a function should only give data, and should not let its functionality "leak out" (sorry I am struggling to describe this well).
Am I willing to fix
Yes, I just wanted to know if people agreed with me first :)
- Dominant language
- JavaScript
- Stars
- 268
- Forks
- 240
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from codebar/tutorials
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
-
Difficulty 1/5 Under an hour Newbie friendliness 45/100
All issues in codebar/tutorials
Similar issues
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
apache/cloudstack#14222 ·
-
Browser Waiting for: Product Owner
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
getsentry/sentry-javascript#24577 · 1 comment ·
-
curation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
amponce/archive-movie-browser#186 ·
-
light
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
aemdemos/patients-stryker#253 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
clerk/javascript#9852 ·